Click here to Skip to main content
15,895,740 members
Please Sign up or sign in to vote.
1.44/5 (3 votes)
See more:
I have a web form that has validators on it along with textboxes. I want the user to save their data so that they can come back and finish their work. When the user clicks on the save button the validations fires which is what I want but I still want the data to save in the database. Is there a way to do this and keep the validators firing?
Posted
Comments
Sergey Alexandrovich Kryukov 17-Oct-14 14:15pm    
If you really need validation, your approach is correct. I cannot see any problem or controversy.
—SA

1 solution

What you're trying to achieve is like offline versions of forms. If so, you can automatically save the data of the user in the localStorage (HTML5). https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage[^]

You can save the data the user would input in the localStorage, and upon the Save button clicks, you can validate the data. Note that there are many methods to validate the data. Using client-side code as well as using server-side code.

It depends on how you want to implement the validation to your data.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 17-Oct-14 17:16pm    
5ed. Local storage is a good idea, but only in case server-side validation is and postback is used. Otherwise, validation would not removed the data entered by the user, nothing to save. Server-side validation makes sense, it can make things safer.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900