Available options


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)
“function”
“clean”
“blur”

Specifies how the plugin will be executed:

submit : Validation is executed in the submit event, blocking the submission when there are invalid values, it can also be used to validate a single field.

function : The validation is executed as a function call immediately, it only returns: true, false or null (in validations with ajax). A single form is invoked and the form must be submitted manually, either in the success event of the plugin or using the result in external code.

clean : Immediately clean the form of the validation and decoration messages.

blur: Activates field-by-field validation in blur events, can only be used in conjunction with the "function" mode .

blur

true (default)
false

Activate field-by-field validation in blur events, equivalent to "blur" mode , but only works when the mode is "submit".

decorate

true
false

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)
css color specification (by name or hexadecimal value)

Define the border color for decorating invalid fields.

style

Default value:
“display: none; color: net; text-align: inherit; font: italic bold .9em sans-serif ”

Define css style of validation messages.

You can place display: none; to activate the FadeIn effect in messages.

template

Default value:
“<p class =" dj-validator-msg "style =" $style "> $msg </p>”

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.

The class "dj-validator-msg" must be preserved to identify and delete validation messages

request_method

"Post" (default)
"get"

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.

Function ” mode : It is not executed, except when validation is used on the server, in this case it is required to declare this function.