Saturday, 15 January 2011

jQuery validation issue in tabbed page -


I have a different version of 4 tabbed tabs on each tab, for each form number it is assumed that < Strong> can not be & gt; 100.

I wrote this jQuery code to validate the form to ensure that the entered number & lt; 100:

  $ (document) .ready (function () {var stop submit = 0; $ ('# targetForm'). Submit (function () {$ (': input' $ ('# Message'). $ ('# Message') .Fedote (4000); stopped = 1;} // END IF}); if (submit submit == 1) {preventSubmit = 0; return false ;} / END IF});});   

This works fine, but only with the form on the first tab. If I click on the second tab and submit invalid data (more than 100) then this is not valid.

Any thoughts?

Thanks

After each click on each tab and request your AJAX Has modified the form, make sure to call your handler again and add it to the form:

  $ ('# targetForm'). Submit (function ($ (': input', '# targeting'). Each (function () (if (this.value & gt; 100) {$ ('# message'). FadeIn (); $ ('# Message ') .fadeOut (4000); Pause = 1;}}); (submit submit == 1) {prevent_submit = 0; return back;}});   

Believing is a global JavaScript, it only ever starts once when the page is initially loaded. It is not run again when AJAX requests are sent and the form on the same page Is modified. this Rkar present you after your AJAX request return of this function is the back need to call to make sure that the new modified form.

No comments:

Post a Comment