I'm working with a form where I am checking the values to ensure that the fields are not blank.
I can use a simple if statement, like this:
if(myValue == "")
But this doesn't account for multiple spaces. For example, if a user tabs in there and hits the space bar, it sees the values as " ", not as "".
So, right now, I have this:
if(myValue == "" || myValue == " " || myValue == " " || myValue == " " || myValue == " ")
It works, but obviously, that's pretty "jury-rigged," don't you think?
And, of course, if they type more than four space, it won't work, because 5 spaces and up are not included in my IF statement.
Is there any means of checking that basically doesn't except "space" as a value?
(Of course, they could type in gibberish, or an X or something, so it's not like I'm expecting it to be fool proof. But it involves some scripting where the original description of what is intended in the field ("Your Phone Number," for example) is INSIDE as the initial value. So the application has some potential for them tabbing in and accidentally erasing the initial value, and I want a way to detect that it was "spaced over" so I can put it back in there.)