This project is read-only.

Using xVal outside of a Form tag

Aug 14, 2009 at 4:30 AM

First off I have to say Great job Steve.  I think your framework is pretty clean and solid.  I've seen another homegrown approach at this and it was much more complicated and didn't use DataAnnotations and I personally found it way more clumsy to use than this.  So now to my point...

I want to use xVal in a new app I'm building that uses ajax pretty heavily.  As such we aren't actually doing form submits to transfer data to the mvc controllers.  Instead we are posting up the data using json using a jquery .ajax call.  So my question is this.  How hard would it be to rewrite xVal to work outside of Form tags?  I haven't done a spike on what it would take yet so any input would be helpful.  I hope it's doable b/c I don't know another solid option to use at this point.


Aug 14, 2009 at 5:07 PM
Edited Aug 14, 2009 at 5:16 PM

If you know JavaScript and jQuery very well, then I don't think it's hard, just time consuming. You will need to make changes in multiple places and test it a lot. I think the two places that need changes are the JavaScript files, "xval.jquery.validate.js" and "jquery.validate.js". Start by searching the keyword "form" and trace it from there.

Another workaround is to create dummy forms, which make things less time consuming. Because the JavaScript files use the "form" tag for its business logic.

Those are the two solutions I can think of briefly. Good Luck!