ketchup-plugin icon indicating copy to clipboard operation
ketchup-plugin copied to clipboard

We really need a submitHandler

Open talamaska opened this issue 15 years ago • 4 comments

I can use you validation only if the forms are submitting normally to another window. I need to use it with ajaxSubmit instead of submit. please

talamaska avatar Jan 12 '11 13:01 talamaska

I needed something like that and added a trigger for ketchup to pick up and validate.

bindFormSubmit: function(form) {
  var self = this,
      opt  = this.options;

  form.submit(function() {
        return self.allFieldsValid(form, true);

  });


      form.bind('validateMe', function() {
          return self.allFieldsValid(form, true);
      });


},

hellokingdom avatar Jan 19 '11 10:01 hellokingdom

I too need an ajax submit. Can you please explain your trigger. How do you actually trigger the event?

smetal avatar Apr 13 '11 18:04 smetal

Turns out i was able to do this:

var result = $.ketchup.allFieldsValid($("#formId"), true);

result will contain either true or false to determine if everything was validated

smetal avatar Apr 13 '11 18:04 smetal

Dear Author, without your permission, I made a change to your script, for use submitHandler. Thank you for pretty work.

For use submitHandler, please Delete :

return self.allFieldsValid(form, true);

and include: if (self.allFieldsValid(form, true)) { if (opt.customSubmit != null) { return opt.customSubmit(form); } return true; } else { return false; }

Useing example :
$('.feedback_form').ketchup({customSubmit: function(form){ return YOURcustomSubmitFunction(); // }});

makm avatar Dec 16 '11 12:12 makm