powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / HTML, JavaScript, VBScript, CSS [игнор отключен] [закрыт для гостей] / jquery Validation Engine: несколько стилей
3 сообщений из 3, страница 1 из 1
jquery Validation Engine: несколько стилей
    #38800819
Фотография pahhan
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
всем доброго времени суток
у меня в codeigneter работает Validation Engine и мне для разных случаев и разных форм необходимо использовать разные стили для сообщений об ошибках. Не подскажете как это сделать?
...
Рейтинг: 0 / 0
jquery Validation Engine: несколько стилей
    #38803838
Фотография pahhan
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Нашел вот такое

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.



Но как пользоваться так и не понял. Кто может помочь? Плииииз
...
Рейтинг: 0 / 0
jquery Validation Engine: несколько стилей
    #38803979
Фотография pahhan
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Админы, закройте или удалите тему, пожалуйста
Я создам новую, я тут бреда написал
...
Рейтинг: 0 / 0
3 сообщений из 3, страница 1 из 1
Форумы / HTML, JavaScript, VBScript, CSS [игнор отключен] [закрыт для гостей] / jquery Validation Engine: несколько стилей
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]