Side navigation
Ticket #2633: example.html
File example.html, 4.0 KB (added by xfactor973, April 01, 2008 06:43PM UTC)
Quick example
<html>
<head>
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.2.3.min.js"></script>
<script type="text/javascript" src="file:\\C:\Java\jquery\jquery.validate.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$.validator.addMethod("greaterThan",function(value,element,param){
min = jQuery(param).val();
max = value;
confirm('min: ' + min);
confirm('max: ' + max);
confirm(min < max);
return min < max;
},"Please make sure the maximum price is greater than the minimum price");
//Form validation
$('#basic_form').validate({
//debug: true,
rules: {
max_price: {
greaterThan: "#min_price"
}
}
});
});
</script>
</head>
<body>
<form id="basic_form">
<select name="min_price" id="min_price">
<option value="99999">No Minimum</option>
<option value="100000">$100,000</option>
<option value="125000">$125,000</option>
<option value="150000">$150,000</option>
<option value="200000">$200,000</option>
<option value="225000">$225,000</option>
<option value="250000">$250,000</option>
<option value="275000">$275,000</option>
<option value="300000">$300,000</option>
<option value="350000">$350,000</option>
<option value="400000">$400,000</option>
<option value="450000">$450,000</option>
<option value="500000">$500,000</option>
<option value="550000">$550,000</option>
<option value="600000">$600,000</option>
<option value="700000">$700,000</option>
<option value="800000">$800,000</option>
<option value="900000">$900,000</option>
<option value="1000000">$1,000,000</option>
<option value="1250000">$1,250,000</option>
<option value="1500000">$1,500,000</option>
<option value="2000000">$2,000,000</option>
<option value="2500000">$2,500,000</option>
<option value="3000000">$3,000,000</option>
<option value="5000000">$5,000,000</option>
</select>
<br>
<span class="body">to</span>
<br>
<select name="max_price" id="max_price">
<option value="125000">$125,000</option>
<option value="150000">$150,000</option>
<option value="200000">$200,000</option>
<option value="225000">$225,000</option>
<option value="250000">$250,000</option>
<option value="275000">$275,000</option>
<option value="300000">$300,000</option>
<option value="350000">$350,000</option>
<option value="400000">$400,000</option>
<option value="450000">$450,000</option>
<option value="500000">$500,000</option>
<option value="550000">$550,000</option>
<option value="600000">$600,000</option>
<option value="700000">$700,000</option>
<option value="800000">$800,000</option>
<option value="900000">$900,000</option>
<option value="1000000">$1,000,000</option>
<option value="1250000">$1,250,000</option>
<option value="1500000">$1,500,000</option>
<option value="2000000">$2,000,000</option>
<option value="2500000">$2,500,000</option>
<option value="3000000">$3,000,000</option>
<option value="5000000">$5,000,000</option>
<option value="999999999">No Maximum</option>
</select>
<br>
<input type="submit" value="Submit"/>
</form>
</body>
</html>
Download in other formats:
Original Format
File example.html, 4.0 KB (added by xfactor973, April 01, 2008 06:43PM UTC)
Quick example
<html>
<head>
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.2.3.min.js"></script>
<script type="text/javascript" src="file:\\C:\Java\jquery\jquery.validate.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$.validator.addMethod("greaterThan",function(value,element,param){
min = jQuery(param).val();
max = value;
confirm('min: ' + min);
confirm('max: ' + max);
confirm(min < max);
return min < max;
},"Please make sure the maximum price is greater than the minimum price");
//Form validation
$('#basic_form').validate({
//debug: true,
rules: {
max_price: {
greaterThan: "#min_price"
}
}
});
});
</script>
</head>
<body>
<form id="basic_form">
<select name="min_price" id="min_price">
<option value="99999">No Minimum</option>
<option value="100000">$100,000</option>
<option value="125000">$125,000</option>
<option value="150000">$150,000</option>
<option value="200000">$200,000</option>
<option value="225000">$225,000</option>
<option value="250000">$250,000</option>
<option value="275000">$275,000</option>
<option value="300000">$300,000</option>
<option value="350000">$350,000</option>
<option value="400000">$400,000</option>
<option value="450000">$450,000</option>
<option value="500000">$500,000</option>
<option value="550000">$550,000</option>
<option value="600000">$600,000</option>
<option value="700000">$700,000</option>
<option value="800000">$800,000</option>
<option value="900000">$900,000</option>
<option value="1000000">$1,000,000</option>
<option value="1250000">$1,250,000</option>
<option value="1500000">$1,500,000</option>
<option value="2000000">$2,000,000</option>
<option value="2500000">$2,500,000</option>
<option value="3000000">$3,000,000</option>
<option value="5000000">$5,000,000</option>
</select>
<br>
<span class="body">to</span>
<br>
<select name="max_price" id="max_price">
<option value="125000">$125,000</option>
<option value="150000">$150,000</option>
<option value="200000">$200,000</option>
<option value="225000">$225,000</option>
<option value="250000">$250,000</option>
<option value="275000">$275,000</option>
<option value="300000">$300,000</option>
<option value="350000">$350,000</option>
<option value="400000">$400,000</option>
<option value="450000">$450,000</option>
<option value="500000">$500,000</option>
<option value="550000">$550,000</option>
<option value="600000">$600,000</option>
<option value="700000">$700,000</option>
<option value="800000">$800,000</option>
<option value="900000">$900,000</option>
<option value="1000000">$1,000,000</option>
<option value="1250000">$1,250,000</option>
<option value="1500000">$1,500,000</option>
<option value="2000000">$2,000,000</option>
<option value="2500000">$2,500,000</option>
<option value="3000000">$3,000,000</option>
<option value="5000000">$5,000,000</option>
<option value="999999999">No Maximum</option>
</select>
<br>
<input type="submit" value="Submit"/>
</form>
</body>
</html>