Forums

Validate two fields

Zilvermeeuw 19 Aug, 2008
Hi!

I try to validate a radio button and two fields. My form looks like:
<input tabindex="7" type="text" name="contact[telefoon]">
<input tabindex="8" type="text" name="contact[email]">
<input tabindex="9" name="contact[contact]" id="contact" type="radio" value="telefoon" checked>Telefoon.
  <input name="contact[contact]" type="radio" value="email">E-mail.

In the tab =Validation=, at =12- validate-one-required=, I added "contact".
In =validation.js= I changed the code under =validate-one-required= to handle the array contact[], but it does not work.

I also tried in the tab =Validation=: "contact[]", but only something like "contact[contact]" seems to pass one index of the array.

How can I pass the array to validation.js?
cjmicro 19 Aug, 2008
I did this just by using the forms validation tab. But I used the mootools validation.

There was actually an update to the .js file which once I used that it worked. So I uploaded that file (there was a thread about it where Bob posted the new file, link below), then under validation just check enable validation- yes, validation library - mootools, then put my check box field in the radio/checkbox area. If you have more than one to validate, there is information here:

http://www.chronoengine.com/forums.html?cont=posts&f=2&t=8289&p=8298&hilit=validate+check+box#p8298

The update to the moovalidation.js is also there.

Not sure if this helps, but maybe that thread will.
Cheryl
GreyHead 19 Aug, 2008
Hi Zilvermeeuw,

See Cheryl's reply for the validation. 'Validate-one-required' is intended to work for arrays of radio buttons or checkboxes. I dont know if it will work in a mixture of tags like this.

Bob
This topic is locked and no more replies can be posted.