Browse Source

Better implementation of #6016 passing value to callback

fix-flex
Jack 7 years ago
parent
commit
e137ee1bfd
2 changed files with 4 additions and 6 deletions
  1. 2
      RELEASE-NOTES.md
  2. 8
      src/definitions/behaviors/form.js

2
RELEASE-NOTES.md

@ -10,7 +10,7 @@
**Enhancements**
- **Search** - Adds disabled variation **Thanks @prudho** #6225
- **Form Validation** - Form prompt can now be returned by a function **Thanks @xDaizu** #6016 #3864
- **Form Validation** - Form can now return their validation prompt dynamically based on their current value. **Thanks @xDaizu** #6016 #3864
**Bugs**
- **Dropdown** - Fixed `onChange` missing `text` from callback when dropdown is set to `action: 'select'` #4183 #4510

8
src/definitions/behaviors/form.js

@ -435,18 +435,16 @@ $.fn.form = function(parameters) {
var
ruleName = module.get.ruleName(rule),
ancillary = module.get.ancillaryValue(rule),
$field = module.get.field(field.identifier),
value = $field.val(),
prompt = $.isFunction(rule.prompt)
? rule.prompt()
? rule.prompt(value)
: rule.prompt || settings.prompt[ruleName] || settings.text.unspecifiedRule,
requiresValue = (prompt.search('{value}') !== -1),
requiresName = (prompt.search('{name}') !== -1),
$label,
$field,
name
;
if(requiresName || requiresValue) {
$field = module.get.field(field.identifier);
}
if(requiresValue) {
prompt = prompt.replace('{value}', $field.val());
}

Loading…
Cancel
Save