by truebosko · 13y ago · 0 comments
Having just hit this situation (validating a form client-side), I found the best solution was to transport the form schema from the server (because I use Django, I can easily whip up a ModelForm), then push that into a simple Javascript Form object which renders the schema and adds validation. Maybe there's better ways, but that's what worked for me. Curious what others have done .. :-)
Yii framework (PHP) supports validation through Ajax (serializes the form, sends for regular server-side validation and displays the errors on the form). A godsend if your form does not change, and impossible to work with if it is dynamic (consider batch entries with "Add line" features, etc.).
I haven't seen a seamless integration on this higher level.
I ported django.forms to JavaScript so I could use it with Node.js, but it also runs on the client: https://github.com/insin/newforms
Could be useful to plug the two together.
Your solution sounds nice for single page apps.