I have two field like this,
<tr>
<td align="right"><b>Min Capacity:</b></td>
<td><input type="text" name="cbbMinCap" value="" class="validate[custom[integer],required,minSize[1], maxSize[4]] text-input"/></td>
</tr>
<tr>
<td align="right"><b>Max Capacity:</b></td>
<td><input type="text" name="cbbMaxCap" value="" class="validate[custom[integer],required,minSize[1], maxSize[4]] text-input"/></td>
</tr>
My goal is to validate Min Capacity < Max Capacity. I checked in jquery.ValidationEngine.js
but can't found it. Please help me.
You can use custom validation
i have given full codes now
<script type="text/javascript">
jQuery.validator.addMethod("lessthan", function(value, element, params) {
return this.optional(element) || value <$(params).val();
}, jQuery.validator.format("Please enter the correct values"));
jQuery(document).ready(function(){
$("form").validate({
rules: {
cbbMaxCap: {
required:true,
lessthan: "#cbbMinCap"// this is id you want to compare tp this input
},
cbbMinCap:{
required:true,
},
}
});
});
</script>
for input fields give a id (or class)
<input type="text" name="cbbMinCap" value="" class="" id="cbbMinCap"/>
<input type="text" name="cbbMaxCap" value="" class="" id="cbbMaxCap"/>
you can use validation engine from http://jqueryvalidation.org