Hi,
Brand new to all this and also to the forum - so firstly forgive if in the wrong place or been asked before. I have searched and I don't see this - so here goes.
I have a form that, amongst other things, has a field called width which I want to validate to be within an acceptable range. The values should be constrained by 2 hidden fields on the form called min_width and max_width. These are specified in the validate() function under the rules: option as so:
- rules: {
- win_stl: "required",
- win_width:
- {
- required: true,
- range: [$("#min_width").val(), $("#max_width").val()]
- },
- win_height:
- {
- required: true,
- range: [$("#min_height").val(), $("#max_height").val()]
- },
- win_glp: "required",
- win_glf: "required",
- win_han: "required",
- win_hng: "required",
- win_tvt: "required"
- },
All seems to work well in that it reports incorrect values and accepts those within the correct range.
However, it is possible using a selection drop down to select a different product (value of win_stl changes). In such a case, I fire of an Ajax request to the server to get the new details for the product including potentially new values for min_width and max_width.
At this point I would REALLY like to be able to trigger the validation to rerun being as the constraints may have changed - but I can't figure out how to do that (I've been trying $("#form_name").validate().form() - but it doesn't seem to be effective).
But the bigger problem after having done a new selection which does have different values for the constraint pairs and keying a new value in is that the Validator appears to be still using the previous constraints. I have checked that the new values have been loaded into the form by viewing the same in Firebug.
I will try and create a simple cut down version if this to see if it behaves the same.
But any help/hints on either of the issues would be most helpful and greatly appreciated.
Many Thanks