I have these validation rules:
$("#ed_details").validate({
rules: {
tagno: { required: true },
itemid: { required: true },
ralno: { required: true },
feet: { required: true, number: true, min: 0 },
inches: { required: true, number: true, min: 0 },
cms: { required: true, number: true, min: 0 },
length: { required: true, number: true, max: $('#maxlength').val() },
qty: { required: true }
}
});
This is the field for which the length is checked. This text is for testing purposes only. It will be hidden after it works.
<input type="text" name="maxlength" id="maxlength" value="<?=$maxL['ml']?>" />
This works fine if I don't change the maxlength value at runtime (which could happen). The user selects an item from the drop-down list. Each item has a maximum tube length that can be used with it. When an element changes, the value of maxlength changes on the screen. However, when checking is done, I see an error message based on the original length (0 for the new item, no matter what the maximum length was when loading for editing).
Please enter a value less than or equal to 156.
I see this even if the maxlength field shows a different value.
Firebug , . , maxlength .
.