New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cancel validation when submitting form via javascript #1513
Comments
I will try to workaround this problem by retrieving the form's validator and setting the internal per html-spec a |
in code, my current, ugly but working solution is: $f = $("#myform");
$f.data('validator').cancelSubmit=true;
$f.submit(); |
That doesn't look too terrible. I've looked into it, but couldn't come up with any reasonable generic solution. The only option I see is to document the Any (other) ideas? |
Not sure whether documenting this property (and therefore promote it as public api) is a good thing. Maybe we should instead add a method, to not mix up public api with a lot of different concepts (we already have a lot of ways of achieving things... options, api methods). A |
You could hack jQuery's |
After lookin at the problem from another angle, I guess we could (and maybe even should) check whether the event passed into [1] http://api.jquery.com/event.isDefaultPrevented/ That way I could use a custom submit listener which is triggered before the jquery-validate and stop the validation there? |
That sounds good to me. The jQuery UI dialog widget does that, too, though to deal with key events. |
Inside a jquery-validated form I have a
<a>
link which is used submit the form and regenerate a captcha image.The logic on the link is like
onclick="$(this).closest("form").submit()"
.In our forms the client side validation now kicks in and does not allow the form submit.
I need something like the
formnovalidate
orclass="cancel"
mechanism, but atm this features are only implemented on elemtens matching:submit
. So this doesnt work for my<a>
.Since this is a very basic re-usable component I cannot "just change the markup or js".
https://github.com/jzaefferer/jquery-validation/blob/master/src/core.js#L27
The text was updated successfully, but these errors were encountered: