You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also, need a behavior to reset a field that currently has an error and message showing.
$('.ui.form').form('reset field', 'first-name')
or $('.ui.form').form('reset', 'first-name') (will only reset specified field in this case)
This can be done very easily:
form.js line 201
reset: function(field){// pass in a field identifier or leave blank, then use filter()field=(field!==undefined) ? field : '';field=('[name="'+field+'"]');$field.filter(field).each(function(){var$field=$(this),$element=$field.parent(),$fieldGroup=$field.closest($group),$prompt=$fieldGroup.find(selector.prompt),defaultValue=$field.data(metadata.defaultValue),isCheckbox=$element.is(selector.uiCheckbox),isDropdown=$element.is(selector.uiDropdown),isErrored=$fieldGroup.hasClass(className.error);
More
Two more behaviors add rule (adds a new rule to a field) and remove rule (removes an existing rule from a field, example empty. This can be used to dynamically toggle required fields)
The text was updated successfully, but these errors were encountered:
kmd1970
changed the title
[Form][Enhancement] Please add 'validate field(field)' and 'reset field(field)' behaviors
[Form Validation][Enhancement] Please add 'validate field(field)' and 'reset field(field)' behaviors
Apr 7, 2017
We really need a behavior to trigger validation (check rules, show error or success) for individual form fields:
$('.ui.form').form('validate field', 'first-name')
Edit Looks like this (hidden?) behavior already exists, but has to be called like this:
this shortcut also works
form.js line 853 (docs issue?)
Also, need a behavior to reset a field that currently has an error and message showing.
$('.ui.form').form('reset field', 'first-name')
or
$('.ui.form').form('reset', 'first-name')
(will only reset specified field in this case)This can be done very easily:
form.js line 201
More
Two more behaviors
add rule
(adds a new rule to a field) andremove rule
(removes an existing rule from a field, exampleempty
. This can be used to dynamically toggle required fields)The text was updated successfully, but these errors were encountered: