Validation radio group

Rajah 21 May, 2008
I have the form working now with copy to sender, thanks to sender, email template, redidrect to url, anti spam, backup😉 , export records and attachments. To be short: a very nice component! Much much better than FacileForms.

There is just one problem left: validation of the radio group.
I did put the field name in 12: Radio/Checkbox (and tried other fields too) but it does noet work. Or does it on your computer :laugh:
GreyHead 21 May, 2008
Hi Rajah,

You need to do something slightly different with checkbox validation and ChronoForms doesn't yet support it properly. You need validate-one-required. If you search the forums there's been a recent post about this - in the last week or two I think.

Bob
Rajah 21 May, 2008
Hi Bob,

Is far as I did understand what was posted before,I did use the "validate-one-required"
That you have to choose one of the radio selections works well.
The problem is that the form will be sent, even if there has not have been made a choise.
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>   
 <div class="kampeermiddel">
<label>Kampeermiddel: Caravan<input type="radio" name="kampeermiddel" <?php if($_POST['kampeermiddel'] == 'Caravan')  echo 'checked'; ?> value="Caravan" />
<label>Camper<input type="radio" name="kampeermiddel" <?php if($_POST['kampeermiddel'] == 'Camper')  echo 'checked'; ?> value="Camper" />
<label>Vouwwagen<input type="radio" name="kampeermiddel" <?php if($_POST['kampeermiddel'] == 'Vouwwagen')  echo 'checked'; ?> value="Vouwwagen" />
<label>Tent<input type="radio" name="kampeermiddel" <?php if($_POST['kampeermiddel'] == 'Tent')echo 'checked'; ?> value="Tent" class="validate-one-required" />  </div>  </td>
</tr>
</table>
I found that if you (I) use the radio codes as:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>   
 <div class="kampeermiddel">
<label>Kampeermiddel: Caravan<input type="radio" name="kampeermiddel" <?php if($_POST['kampeermiddel'] == 'Caravan')  echo 'checked'; ?> value="Caravan" />
<label>Camper<input type="radio" name="kampeermiddel" <?php if($_POST['kampeermiddel'] == 'Camper')  echo 'checked'; ?> value="Camper" />
<label>Vouwwagen<input type="radio" name="kampeermiddel" <?php if($_POST['kampeermiddel'] == 'Vouwwagen')  echo 'checked'; ?> value="Vouwwagen" />
<label>Tent<input type="radio" name="kampeermiddel" <?php if($_POST['kampeermiddel'] == 'Tent')echo 'checked'; ?> value="Tent" class="validate-one-required" />  </div>  </td>
</tr>
</table>
the validation does not work at all anymore in most cases.

(Sorry, can't get the code right. It differs from Preview, where it is ok.)
GreyHead 22 May, 2008
Hi Rajah,

No idea what's happening here, I'll take a look later on.

Bob

PS Yes the forum code handling is messed up badly, don't know why. I have to replace all < with < and then the line-breaks in the plain text get messed sometimes :-(
Rajah 22 May, 2008
Hi Bob,

1. I found out that using mootools in Validation this problem is solved. The only thing now is that the validation does not check the radio group as a required field.

2. Is it possible to keep the form data of the upload field of an attachment?

3. Is it possible to have the messages in another color?

These are questions of a perfectionist😉
hicksticks2001 26 Jun, 2008
There is a java file called validation.js. If you search the file for the words "style" you will find it setting the style DISPLAY to NONE. You can add other attributes such as color or strength, and it will work properly.
This topic is locked and no more replies can be posted.