Jörn,

>I like the idea.Gonna test if that works out.
>
>About the xor-validation, I wonder if this could work:
>
>$.validator.addMethod('xor', function(value, element, parameter) {
>       return value && $(parameter).is(":blank");
>});
>
>rules: {
>       field1: { xor: "#field2" },
>       field2: { xor: "#field1" }
>},
>messages: {
>       field1: "Please specify either field1 or field2",
>       field2: "Please specify either field1 or field2"
>}
>
>If both are empty, both are invalid. If both have a value, both are
>invalid. Whats left are two valid combinations. Am I missing something,
>apart from trying it out?


The biggest issue I can see if that the error is going to get thrown
twice--and you really only want the error thrown once. I mean there may be a
time when you want the message to be shown twice, but in a case like the
following, you really only want 1 message:

Search by area code [_______] or zip code [______]

-Dan

PS - I'm not saying that's the best UI choice, just giving an example of why
you might not want the error thrown twice. :)

Reply via email to