Hi there,
I want to validate a checkbox group with JS, but when i use the statement:for this kind of checkbox group:
It doesn't validate and it immediately posts the form.
I am not sure if i am doing something wrong.
Can anybody help this situation?
Thanks in advance..
I found the solution by myself
I forgot the slashes, it needs to be like this:
I want to validate a checkbox group with JS, but when i use the statement:
Code:
rules.push("required,accomodationtype[],Please check all that apply");
Code:
<INPUT type="checkbox" name="accomodationtype[]" id="accomodationtype_0" value="hotel1">Hotel1<BR>
<INPUT type="checkbox" name="accomodationtype[]" id="accomodationtype_1" value="hotel2">Hotel2<BR>
<INPUT type="checkbox" name="accomodationtype[]" id="accomodationtype_2" value="hotel3">Hotel3<BR>
<INPUT type="checkbox" name="accomodationtype[]" id="accomodationtype_5" value="other"> Other (please specify)<BR>
<INPUT type="text" name="accomodationtypeother" id="accomodationtypeother">
It doesn't validate and it immediately posts the form.
I am not sure if i am doing something wrong.
Can anybody help this situation?
Thanks in advance..
I found the solution by myself
I forgot the slashes, it needs to be like this:
Code:
rules.push("required,accomodationtype\[\],Please check all that apply");