A text field considering space as an data .

A text field is considered space as a data so how to resolve it so that it wouldn't submit untill the actual data is inserted.

  Discussion posts and replies are publicly visible

Parents
  • I assume you've made your text field "required" but that someone is entering a space which is being considered to be data and thus allowing the user to submit the form? The easiest way to think about this is to think about what would the content of your field be if all the spaces were removed. If the length of the resulting value is 0 (i.e it only contains spaces) then you can use this information to throw a validation error, which will then prevent the user form submitting the form.

Reply
  • I assume you've made your text field "required" but that someone is entering a space which is being considered to be data and thus allowing the user to submit the form? The easiest way to think about this is to think about what would the content of your field be if all the spaces were removed. If the length of the resulting value is 0 (i.e it only contains spaces) then you can use this information to throw a validation error, which will then prevent the user form submitting the form.

Children