Created
December 6, 2017 07:30
-
-
Save imanilchaudhari/24943d73717bf1e37d50c14606bd9eab to your computer and use it in GitHub Desktop.
Yii2 add custom error message on form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery("#{form-id}").yiiActiveForm("add",{ | |
"id": "field-id", | |
"name": "{field-name}", | |
"container": ".field-{field-id}", | |
"input": "#{field-id}", | |
"error": ".help-block", | |
"validate": function(attribute, value, messages, deferred, $form) { | |
yii.validation.required(value, messages, { | |
"message": "{message}" | |
}); | |
yii.validation.string(value, messages, { | |
"message": "{message}", | |
"max": 90, | |
"tooLong": "{tooLangMessage}", | |
"skipOnEmpty": 1 | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment