14. Spring - Jquery Validation Plugin

Jquery Validation Plugin

JQuery validator

Go to bellow site and download and add JS to project.



 

jquery.validate.js is only required min version can be used in production.

Add above table and dialog box and then add bellow js code.


<sf:form id="categoryForm" class="form-horizontal" modelAttribute="category"
action="${contextRoot}/manage/category" method="POST"></sf:form>



$categoryForm = $('#categoryForm');
if($categoryForm.length) {
$categoryForm.validate({
rules: {
name: {
required:true,
minlength:3
},
description: {
required:true,
minlength:3
}
},
messages: {
name: {
required:'Please enter product name!',
minlength:'Please enter atleast five characters'
},
description: {
required:'Please enter product name!',
minlength:'Please enter atleast five characters'
}
},
errorElement :"em",
errorPlacement :function(error, element) {
errorPlacement(error, element);
}
}
);
}

..

Comments

Popular posts from this blog

09.Data Binding.

Database - Topics

02. Spring – Creating spring project clone it with GIT step by step.