I'd like to add js validation to my forms, and that validation should be done without requests to my server.
So, say, I open a page with form, make some errors and js code show me (without single request to the server) that, say, this field is required, this field is too short, this field should be a number etc.
The main idea - DRY - this js code should be auto-generated and/or it should get validation rules from form.
Now I would implement such validation by writing custom js code (or use some form validation libraries), and I need to duplicate validation rules - in forms and in js code. This is not DRY :) Also I'll get some problems connected with error messages.
Is there solution for my need?
Thanks.
I found this post in my bookmarks, but I haven't tried it out myself yet.
http://eikke.com/django-validation-an-introduction/
it's a small post that explains how to generate client side validation javascript from a Newform form (keeping you dry). some code is also available in a git repository
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With