Manage checkbox values

Loko 15 Dec, 2008
Hello

I have some checkboxes in my Chronoforms (I mean checkboxes and not radio groups). Everything works perfectly but in the received email (from template) the value for this input is default to "ON" when a checkbox is checked. I would like to write "Yes" instead of "ON" in the email.

I'm about to add a hidden text input "associated" to each checkbox,and with some javascript in the onchange of each checkbox, give it the "Yes" value.

Is there any easier way to do this ?

Loko
GreyHead 15 Dec, 2008
Hi Loko,

I think that you can just edit your form HTML and change the value attributes for the checkboxes.

Bob
Loko 15 Dec, 2008
Hi bob

I'm not an HTML guru, but I never understood what the "value" parameter is for checkboxes. Whatever the status -checked or not- the value remains the same.

Try this simple example :
<form>
<input type="checkbox"  value="Yes" name="test" />
<input type="button" onclick="alert(test.value);" />
</form>


L.
GreyHead 15 Dec, 2008
Hi loko,

Yes but it's the value (of the checked boxes) that gets sent back in the $_POST array and shows up in your email.

Bob
Loko 15 Dec, 2008
I still have not understood how I should do.

Where can I put a value for the checked status, and an other for the unchecked status ? And for the email to display the right one ?
GreyHead 15 Dec, 2008
Hi Loko,

If your checkbox is checked then $_POST includes the value; if it's not checked then $_POST has a blank entry.

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