[jQuery Validate plugin] dependency-expression with custom method
Hi,
I have added a new method as shown below, that makes sure that a valid value is selected in the combobox.
- jQuery.validator.addMethod("cb_required", function(value, element, param) {
- return this.optional(element) || value != "Select One";
- },
- "This is required"
- );
This works fine for simple use cases where I set rule as follows
But if I use a dependency expression, it ignores the function. Basically I want a valid value to be selected only if status is not new.
- cb_required: function(element) {
- var statusCombo = $find("<%=cbStatus.ClientID %>");
- var status = statusCombo.get_value();
- return (status != "New")
- }
Thanks