Hi!
I am writing an app that (among other things) allows a user to add or modify customer information. It uses a function to write the add/modify HTML. If the function is passed a customer object, it displays the form populated with the information in the object. If there is no object, it presents a blank form.
I'd like to validate any information provided by the user (length>0, no duplicates, etc) before storing it in the db. I'd also like to accomplish this on the server side.
In the event of an error in the user's input, I'd like to regenerate the same page with the data the user has entered and descriptions of the error(s) that exist (I do not want the user to lose all their entered data just because the class could not save one field because it failed validation).
I pondered setting error flags when setting the properties of the customer object, but wonder if that is a wise thing to do.
Any thoughts?
Guru2B
I am writing an app that (among other things) allows a user to add or modify customer information. It uses a function to write the add/modify HTML. If the function is passed a customer object, it displays the form populated with the information in the object. If there is no object, it presents a blank form.
I'd like to validate any information provided by the user (length>0, no duplicates, etc) before storing it in the db. I'd also like to accomplish this on the server side.
In the event of an error in the user's input, I'd like to regenerate the same page with the data the user has entered and descriptions of the error(s) that exist (I do not want the user to lose all their entered data just because the class could not save one field because it failed validation).
I pondered setting error flags when setting the properties of the customer object, but wonder if that is a wise thing to do.
Any thoughts?
Guru2B