We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
We had need in our project to conditionally add form validation based on workflow steps. We added this method to form module.add:
validation: function ( $field, rule ) { var identifier = $field.attr( 'id' ) || $field.attr( 'name' ) || $field.attr( 'data-' + metadata.validate ), validator ; if ( !validation || !$field.length) { return false; } validator = validation[identifier]; if ( !validator ) { // no rules exist for field, create an empty rule set validator = validation[identifier] = { 'identifier': identifier, 'rules': [] }; } validator.rules.push( rule ); // add the rule return true; },
Which can be called like so $form.form( 'add validation', $field, { 'type': 'empty', 'prompt': 'This field must contain a value' } );
$form.form( 'add validation', $field, { 'type': 'empty', 'prompt': 'This field must contain a value' } );
The text was updated successfully, but these errors were encountered:
#4267 #5253 Adds new behaviors for form validation - Add rule, Add fi…
bd6e37c
…eld, remove field, remove rule
#4267 #5253 Fix some mistaken logic
8f1409a
I've added add field add rule add fields remove rule remove fields in next version, check release notes and above commits for details.
add field
add rule
add fields
remove rule
remove fields
I've also added an example in next doc update.
Sorry, something went wrong.
No branches or pull requests
We had need in our project to conditionally add form validation based on workflow steps. We added this method to form module.add:
Which can be called like so
$form.form( 'add validation', $field, { 'type': 'empty', 'prompt': 'This field must contain a value' } );
The text was updated successfully, but these errors were encountered: