It will be confusing for someone filling out your form if you leave both fields available at the same time, instead... when the user enters text into one of the fields why don't you run an onChange or onKeyPress check to see if they've entered something and if so, disable/hide the other field .attr('disabled', disabled') or .hide() or if they have deleted what's in the field to enable/hide the partner field again... just remember to include null checks to unset the disabling/hiding
On Oct 12, 3:55 am, Phper <hi.steven...@gmail.com> wrote: > Also, how to prevent a user filling out both fields? > > On Oct 12, 4:48 pm, Phper <hi.steven...@gmail.com> wrote: > > > How to change the default position of an error message in Jquey form > > validation plugin? > > > On Oct 12, 4:33 pm, Gordon <grj.mc...@googlemail.com> wrote: > > > > If you're using the Metadata plugin and inline rules: > > > > <input type="text" id="a" class="{validate:{required:'#b:blank'}}" /> > > > <input type="text" id="b" class="{validate:{required:'#a:blank'}}" /> > > > > I've not actually tested it but it should work. > > > > On Oct 11, 4:37 am, Phper <hi.steven...@gmail.com> wrote: > > > > > There are two input fields in a form, but only one of them is > > > > required, they are not required at the same time. Either A or B is > > > > required. ( A is required OR B is required). In other words, a user > > > > can input data to field A, or he can input data to filed B, but he can > > > > not input data to Both A and B at the same time. > > > > > How to implement this constraint in Jquery form validation?