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
Is there a way to validate a field outside of a form? #2209
Comments
Hi @ppetree, Sorry for taking so long to respond. Unfortunately, validating a input outside of a form is not supported and it was already requested in #2156. But you can work around this by using only one form and your onboarding will be inside it. That way you can use |
No worries on the slow response, we all have day jobs. As you and I discussed earlier, there's a number of problems with using forms in mobile apps. There are DOM limits, form action= is unnecessary and unwanted (I spent two full days chasing my tail on this the last time). In mobile apps there are just so many one-off fields that one needs to validate that it would just be soooo nice to do something like:
|
Issue mentioned in #2209 (comment) is about form elements outside of a form, but belonging to the form (linked with the attribute |
I found a way,work in DIV $('#commentForm input[type="submit"]').click(function() {
setTimeout(function() {
$('#commentForm').trigger('submit.validate')
}, 500)
})
$('#commentForm input').each(function() {
// this.form = $('#commentForm')
Object.defineProperty(this, 'form', {get: function(){return $('#commentForm')[0]}})
}) |
This issue/proposal has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automatically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and one of the maintainers will (try!) to follow up. |
Subject of the issue
Validating a field without that field being inside a form.
Your environment
jquery-validate
: 1.17.0Steps to reproduce
Expected behaviour
I would like to call validate(element, rule_obj);
I'm working on an onboarding process. I have a number of divs on a page, only the active div is visible. I want to validate the input fields on the active div before hiding that div and unhiding the next div in the onboarding sequence.
This would be a snap I could specify a single field to validate without using building 6-8 forms on a single page. I don't want the data submitted until I have collected all the data from each div (screen) in the onboarding process.
Is there a way to do this that I can't find in the documentation?
The text was updated successfully, but these errors were encountered: