You can just disable the submit button with jQuery easily. $("#myForm").bind("submit", function() { $(this).validate(validation_options); var valid = $(this).valid(); if (valid) { // disable submit button $("#submitBtn").attr('disabled','disabled'); // put loading animation code here // submit is done automatically, no action needed return true; } });
On Oct 15, 10:48 am, Opally <opally....@gmail.com> wrote: > thanks for the reply James! > > I'm looking at the jquery Validation plugin, and I don't see how the > function you offered integrates with it. Can you offer more detail? > Perhaps I need to modify validator to make these changes in the submit > button? > > I'm hoping the author of Validation will see this question and give me > some guidance where to insert functions to disable the submit button > after it passes validation checks. > > This can't be such a rare need? (we are having slowness with our site > right now, so that makes this important.) > > On Oct 13, 10:43 pm, James <james.gp....@gmail.com> wrote: > > > Maybe something like this: > > > $("#myForm").bind("submit", function() { > > $(this).validate(validation_options); > > var valid = $(this).valid(); > > if (valid) { > > //lockform, show loading animation, dosubmit > > } > > // you don't really need an 'else' here. > > // the errors should display if it's not valid. > > }); > > > On Oct 13, 5:35 am, Opally <opally....@gmail.com> wrote: > > > > This is a question about the jqueryValidationplugin. > > > > I need tolockthesubmitbutton on some forms to prevent multiple > > > submissions, but I don't want to permanentlylockit, in case there's > > > avalidationproblem that the user needs to resolve. I did come up > > > with a way to temporarilylockit and change the text to "Saving, > > > Please Wait..." for a few seconds, then revert it to an unlocked > > >submitbutton. > > > > The problem I'm having is that this conflicts somehow with the jquery > > >validationplugin. Some fields that have error messages if the user > > > attempts tosubmitthe form with missing data. If I use the temporary > > > lockingsubmitbutton (which uses an animation to create a duration) > > > then these error messages do not display. > > > > Is it possible to test for avalidationvalue in a separate function > > > before running thislockfunction? If valid,lock, if not valid, don't > > >lock, because it isn't possible tosubmitan invalid form anyway. > > > > I tried wrapping the lockingsubmitfunction in a setTimeout, but that > > > didn't have any effect at all in delaying it. > >