Browse Source

Fix #1630 reset now clears prompts

pull/1698/merge
jlukic 9 years ago
parent
commit
ee60b5192e
1 changed files with 5 additions and 4 deletions
  1. 9
      src/definitions/behaviors/form.js

9
src/definitions/behaviors/form.js

@ -138,7 +138,8 @@ $.fn.form = function(fields, parameters) {
$field = $(this),
$element = $field.parent(),
$fieldGroup = $field.closest($group),
defaultValue = $field.data(metadata.defaultValue),
$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)
@ -146,6 +147,7 @@ $.fn.form = function(fields, parameters) {
if(isErrored) {
module.verbose('Resetting error on field', $fieldGroup);
$fieldGroup.removeClass(className.error);
$prompt.remove();
}
if(isDropdown) {
module.verbose('Resetting dropdown value', $element, defaultValue);
@ -807,15 +809,14 @@ $.fn.form.settings = {
transition : 'scale',
duration : 200,
onValid : function() {},
onInvalid : function() {},
onSuccess : function() { return true; },
onFailure : function() { return false; },
metadata : {
defaultValue: 'default',
validate: 'validate'
defaultValue : 'default',
validate : 'validate'
},
selector : {

Loading…
Cancel
Save