Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

required text field validation

Avatar

Level 2

Can any one help

I have a required text field and a button when I click the button I validate the text field and messagebox an error message if it is null, however, it passes the validatation if I type spaces (no char) on it.

I want my validation to show error message wether if it is null or if there is/are space(s) in it.

1 Reply

Avatar

Level 9

Hi,

Try this one.

if(TextField1.rawValue == null || TextField1.rawValue == " " || TextField1.rawValue == "  ")

{

   app.alert("Type some character");

}

If you have specified the field to be of limited to visible length. Count the no.of spaces it takes and in the or condition you can put that.

Thanks.

Bibhu.