The plugin can be configured using the following options:
//default values:
$('#form').djValidator({
mode: 'submit',
blur: true,
decorate: true,
border_color: 'red',
style:'display:none; color:red; text-align:inherit; font:italic bold .9em sans-serif',
template:'<p class="dj-validator-msg" style="$style">$msg</p>',
request_method: 'post',
success: function($form){return true;}
});
Option | Allowed values | Description |
mode |
“Submit” (default) |
Specifies how the plugin will be executed: |
blur |
true (default) |
Activate field-by-field validation in blur events, equivalent to "blur" mode , but only works when the mode is "submit". |
decorate |
true |
Activate input decoration when its value is not valid, the decoration consists of changing the border color according to “border_color” property. |
border_color |
“red” (default) |
Define the border color for decorating invalid fields. |
style |
Default value: |
Define css style of validation messages. You can place display: none; to activate the FadeIn effect in messages. |
template |
Default value: |
Define html template of the validation messages, in "$style"
mark the value of the "style" property is inserted and in $msg mark the validation message is inserted. |
request_method |
"Post" (default) |
Defines the communication method when validations are performed on server. |
success |
function ($ form) {return true;} |
“ Submit ” mode : Defines the function to be executed when the form is valid, by default the form is sent automatically when the validation returns true. |