-
using "" within a input text box
i have an input text box called search. The problem is i need the user to enter...
"horror films" AND dvds
and perform an action if they do. So ideally i would write...
if (_root.search==""horror films" AND dvds") but this doesnt work as the "" are reserved for actually quoting the value, so it messes things up.
is there a way around this?
thanks
-
If you are using MX or MX2004, you can give you input box a unique instance name such as search_txt. Then in your if statement you could have if (_root.search_txt.text.toLowerCase()=="horror films and dvds")
One problem you may run into and that is letting the user type their own criteria. If your search criteria is based on specific data, a combobox may be better.
-
thanks for the reply.
not sure if i explained myself correctly.
i have given the input box an isnstance name of search.
its working fine if i use the code...
if (_root.search=="horror films AND dvds")
and the user was to enter: horror films AND dvds
but i need it to work if the user was to enter : "horror films" AND dvds
so the extra "'s are actually part of the input the user would enter. i just dont know how to alter the if statement.
-
Senior Member
There are two ways to work around this:
1. Use single quotes for delimiting pattern string (and double quotes inside it):
if (_root.search=='"horror films" AND dvds')
2. Use a backslash in front of the interior quotes (this is called 'escaping' the quotes):
if (_root.search=="\"horror films\" AND dvds")
- Jim
-
if "searsh" is instance name then
if(_root.search.text=="\""+"horrors films"+"\""+" AND dvd"){...
if "search" is var then
if(_root.search=="\""+"horrors films"+"\""+" AND dvd"){....
Ups, it seams I am late.
-
thanks lads.
worked a treat!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|