Thank you in advance for looking at this. :-)
The form validation itself works on other items where the field is simply required - that is no problem.
I am trying to set a numeric range for validation from my autocomplete dynamically.
I am using the bassistance.de JQuery validation found here.
Upon the select, I am calling a function, but it needs to be added to .validate() code instead of its own function (I think), but now sure how to combine them. The autocomplete is a generic function that is called by multiple inputs.
<script>
$().ready(function() {
// validate the form when it is submitted
$("#form4100").validate();
});
</script>
<script>
function Autocomplete(numberLocation,nameLocation,dscLocation,chargeLocation,amountLocation) {
select: function( event, ui ) {
$(numberLocation).val( ui.item.value );
$(nameLocation).html( ui.item.desc );
alert("Minimum Investment: "+ui.item.minimum);
setvalidation(amountLocation,ui.item.minimum);
return false;
}
}
function setvalidation(amountLocation,minimum){
alert("validation function launched");
amountLocation.validate({
rules: {
field: {
required: true,
range: [minimum, 5000000]
}
}
});
}
</script>
Thanks!