Data Validation - It seems no matter what the user......

One thing I have learned in my ten plus years of building web sites is that data needs to be valid.  If it is not valid, then the application could just blow up and your client will be mad at you/me.  In those ten years I have tried many, many things to make sure users put the right type of data in the fields we provide them.  Credit Cards, Phone Numbers, Money, you get the idea.  No matter what I do, they seem to somehow find a way to get past the javascript, specialized control, etc.

So this morning I woke up to three error messages, all from the same user trying to submit the same bad data to the application three times in succession.  First if you are a user of a web site and you get an error message that says the data you just entered is not valid, please review the data you entered and CORRECT IT!  I guess first you need to read the big red error message that is staring at you first to know the data you have in the form is not valid.

The person evidently had deleted the default value of $0 from an Infragisitcs Currency Control, so now it was NULL.  Dummy me had forgotten to enter a default value for NULL in the control properties, just the minimum of $0 and a default of $0.  I really thought this would solve that issue.  Well evidently the first user did not like seeing a value of $0 in the field and thought nothing would look better.  Now I don't fault the user for being themselves, I do however fault Infragistics for not making their control handle an empty string on this control when there is a minimum value set on the control and just making it 0.

I have now added a value for NULL and put the following code in my form processing method, which should help.  I just do not think I should have to go to these extrodinary lengths to ensure data is valid, this is getting way out of hand at times.  Sometimes there just seem to be applications where the users are just inept and don't read instructions.  This application seems to be one of those for me.

If IsNumeric(txtDollarAmount.ValueDouble) Then

   si.DollarAmount = txtDollarAmount.ValueDouble


   si.DollarAmount = 0D

End If

Share This Article With Your Friends!