Reputation: 5291
Today I asked myself how can I handle user input if the user have not to enter it...
A firstname and lastname is all he must enter. The adress he needs not to fill out.
Now I have to decide, is the missing data a user mistake or didn`t the user want to enter
data?
How can I deal with such a scenario?
Upvotes: 0
Views: 184
Reputation: 1413
If the address field is perfectly valid when blank (i.e. "") then I would first do a check against the length of the data within the address text field.
If the length of the data is > 0
then the validation routine should take place, else the form should continue to process...
If you wanted to get slightly more intelligent with this (and depending on your requirements) you could perhaps put some code in place to check whether the user has entered the address box with their cursor at any point and then carry out validation accordingly.
Upvotes: 1