Having no text doesnt mean the string value is "". An
Empty string is different from a null or an undefined
value. So i suggest throw in a check for
undefined/null value as well and if you dont turst
that enough, check for the length as well.
Moreover, when you say
goodsInAdvice.text.indexOf("/") == 0 ; you are
actually checking for the existence of the "/"
character at the 0th index. If you want to check for
it's absence, try goodsInAdvice.text.indexOf("/") ==
-1 or goodsInAdvice.text.indexOf("/") < 0.
Based on the scenario you have
give, a null/undefined goodsInAccount.text and a
goodsInAdvice.text with "/" in the beginning will
really return true.
--- candysmate <[EMAIL PROTECTED]> wrote:
> I have two textInput components. This code:
>
> if((goodsInAccount.text != "") &&
> (goodsInAdvice.text.indexOf("/") == 0))
> {
> .....
> }
>
> but it returns true when goodsInAccount contains no
> text and
> goodsInAdvice contains the "/" character. The
> problem seems to be with
> the logic knowing that goodsInAccount.text is empty.
> It's tried using
> goodsInAccount.text.length > 0 too.
>
> Maybe I've just not had enough coffee yet, or is
> this a known bug?
>
>
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for
today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow