Open alvarolm opened 10 months ago
The custom prompt has to be provided at type declaration https://fomantic-ui.com/behaviors/form.html#customizing-prompts
rules: [
{
type : 'myrule',
prompt : function() {
return "custom prompt working!"
}
}
]
Your other approach works too, but only if the central value is type of string (this is something we could improve to also accept functions here)
$.fn.form.settings.prompt.myrule = "custom prompt working!";
understood, in my case the prompt is always generated so it needs to be function, for now it seems i will have to provide it each time with a type declaration
may be in the future I'll implement pr, thanks !
may be in the future I'll implement pr, thanks !
I just did by #2977 😉
thank you so much !
Bug Report
when setting the default prompt (function) for a custom rule it triggers the error: Uncaught TypeError: prompt.search is not a function https://github.com/fomantic/Fomantic-UI/blob/develop/src/definitions/behaviors/form.js#L564
Steps to reproduce
set this defaults before instanciating a form
$.fn.form.settings.rules.mindate = function(value) { return false; };
$.fn.form.settings.prompt.mindate = function(v) { return "custom prompt working!" }
Expected result
no error
Actual result
Uncaught TypeError: prompt.search is not a function
Testcase
https://jsfiddle.net/0tsurydw/2/
Screenshot (if possible)
Version
2.9.3