From 9eb4ac3c20fd069034a9406bd3ea1e447c87c560 Mon Sep 17 00:00:00 2001 From: Jack Date: Sun, 18 Mar 2018 17:10:26 -0700 Subject: [PATCH] Implement prompt as a function #6016 --- RELEASE-NOTES.md | 1 + src/definitions/behaviors/form.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 3c967e951..c1b076932 100755 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -10,6 +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 **Bugs** - **Dropdown** - Fixed `onChange` missing `text` from callback when dropdown is set to `action: 'select'` #4183 #4510 diff --git a/src/definitions/behaviors/form.js b/src/definitions/behaviors/form.js index 6c0d0172b..7b2115ac6 100644 --- a/src/definitions/behaviors/form.js +++ b/src/definitions/behaviors/form.js @@ -435,7 +435,9 @@ $.fn.form = function(parameters) { var ruleName = module.get.ruleName(rule), ancillary = module.get.ancillaryValue(rule), - prompt = rule.prompt || settings.prompt[ruleName] || settings.text.unspecifiedRule, + prompt = $.isFunction(rule.prompt) + ? rule.prompt() + : rule.prompt || settings.prompt[ruleName] || settings.text.unspecifiedRule, requiresValue = (prompt.search('{value}') !== -1), requiresName = (prompt.search('{name}') !== -1), $label,