**If this post is a duplicate, I apologize; I never saw the first one
I wrote a day or two ago appear on the list or in search results.

Hi Jörn,

On Apr 13, 1:01 pm, Jörn Zaefferer <[EMAIL PROTECTED]> wrote:
> $(function() {
>             // Rules just for the Financial Info subsection
>             var eligibilityRules = [...]
>
>             // Set up validation on the whole form
>             var validator = $("form").validate({rules: mainRules});
>
>             // Make the buttonvalidatethe subsection on click
>             $("#eligCheck").click(function(evt) {
>
>                 validator.settings.rules = eligibilityRules;
>                 var valid = $("form").valid();
>                 validator.settings.rules = mainRules;
>                 // Set up validation, do it, and check results all at once
>                 if ( !valid ) {
>                     return false;
>                 }
>
>                 // There would actually be an AJAX submit & server validation
>                 // here
>                 alert("Eligible!");
>             });
>         });
>

Thanks for this idea! That did the trick. I feel kind of silly I
didn't think of this simple solution myself. :)

> > Dynamically setting up validation for editable table rows:
> >http://www.gearheadsoftware.com/tableval-112.html
> >http://www.gearheadsoftware.com/tableval-121.html
>
> This is way more complex, I don't have an immediate solution at hand.The
> validation plugin is designed around forms, which aren't available in
> this case.
>
> A first idea that comes to mind is subclassing the validator object to
> use it for these rows. You'd have to write your own init/plugin code,
> but that shouldn't be much of a problem. Actual access to eg.
> element.form happens only in a few places, and these may not even be
> affected in this case.
>
> Let me know if you try to implement that path and have any questions.

Since I require this functionality for my application, I'm definitely
going to try to implement it. I'm not very familiar with subclassing
in a JavaScript context, so if you would be willing to provide a few
more hints about what I should be overriding/changing, I'd be
grateful. :)  If I can somehow get it to validate an arbitrary group
of form elements, without depending on an enclosing form tag, I would
be good to go.

Many thanks,
Bryce Lohr

Reply via email to