views:

16

answers:

1

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?

+1  A: 

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.

Matt Weldon
ah I stepped into a my own validation rule trap :PI can NOT make any rules checking for black/empty string on the optional fields else he is forced to enter at least ONE char as blank fields is an expression of not wanting or have forgotten. So only thing I can do is check the length of the data not allowed > 50 chars for exampleNot a solution, but you brought me onto the right track ;-)for optional I do not care wether its black/not.I check if property length > 0 and if so I check for < 50 chars so its valid
msfanboy