|
|
|
jquery Validation Engine: несколько стилей
|
|||
|---|---|---|---|
|
#18+
всем доброго времени суток у меня в codeigneter работает Validation Engine и мне для разных случаев и разных форм необходимо использовать разные стили для сообщений об ошибках. Не подскажете как это сделать? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 10.11.2014, 14:28 |
|
||
|
jquery Validation Engine: несколько стилей
|
|||
|---|---|---|---|
|
#18+
Нашел вот такое We found a very good plugin for jquery validation at position absolute. We enjoyed the plugin and met most of our requirements but it lacked to show customized error message for a field. It uses generic messages for each form field so we done some modification in the plugin to meet our requirements. With modification, plugin is allowed to display custom message for a form field. We override buildprompt function from the validationengine and added functionality to pick the customized error message. var buildPrompt = $.validationEngine.buildPrompt; $.validationEngine.buildPrompt = function(caller, promptText, type, ajaxed) { // Get the rules to map the message for a method var rulesRegExp = /\[(.*)\]/; var getRules = rulesRegExp.exec($(caller).attr('class')); var str = getRules[1]; var pattern = /\[|,|\]/; var rules = str.split(pattern); //Check if title attribute present in the element //otherwise we shall use default error message if ($(caller).attr('title')) { var getMessages = rulesRegExp.exec($(caller).attr('title')); var str = getMessages[1]; var pattern = /\[|,|\]/; var messages = str.split(pattern); var j = 0; newPrompt = ""; for ( var i = 0; i < rules.length; i++) { rules = $.validationEngine.settings.allrules[rules[i]] if (rules) { if (promptText.indexOf(rules.alertText) != -1) { newPrompt += " ” + messages[j] + ” “; } j++; } } promptText = newPrompt; } buildPrompt(caller, promptText, type, ajaxed); } So in the plugin, we have added error messages in the ‘title’ attribute and this gives the flexibility to customize the error message for different field. Но как пользоваться так и не понял. Кто может помочь? Плииииз ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 12.11.2014, 16:54 |
|
||
|
|

start [/forum/topic.php?fid=22&msg=38803838&tid=1446544]: |
0ms |
get settings: |
11ms |
get forum list: |
18ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
192ms |
get topic data: |
7ms |
get forum data: |
2ms |
get page messages: |
39ms |
get tp. blocked users: |
1ms |
| others: | 256ms |
| total: | 532ms |

| 0 / 0 |
