Forums

Trouble with checkbox

buckwheatpie 25 Aug, 2009
Hi,

After creating a form to enable users to submit details of their projects to an online database, my crew of beta testers said they would like an option to hide the email address they submit with the project details. None too tricky, i thought - ut i'm stuck at the first hurdle!

i added the following code to the form:
<div class="form_item">
  <div class="form_element cf_checkbox">
    <label class="cf_label" style="display: none;">Hide email?</label>
    <div class="float_left">
      <input value="Hide email?" title="" class="radio" id="check00" name="HideEmail" type="checkbox" />
      <label for="check00" class="check_label">Hide email?</label>


And then added a field called "HideEmail" to the table where the data is stored.

However, whether the checkbox is checked or not, nothing alters in the "HideEmail" field in the table.

I'm sure i;ve missed something obvious... any ideas?

Thanks!
GreyHead 25 Aug, 2009
Hi buckwheatpie,

ChronoForms keeps a record of the databse column entries in the form database record. You may need to refresh this by undoing the DB Connection, save the form, then re-male the connection and save again.

Bob
buckwheatpie 26 Aug, 2009
Thanks for that, breaking and then remaking the connection worked.

However, i decided to change it to a radio ttuon with yes / no options:

  <div class="form_element cf_radiobutton">
    <label class="cf_label" style="width: 150px;">Hide email?</label>
    <div class="float_left">

<input value="No" title="" class="radio validate-one-required" id="radio00" name="HideEmail" type="radio" checked/>
      <label for="radio00" class="radio_label">No</label>
      
<input value="Yes" title="" class="radio validate-one-required" id="radio01" name="HideEmail" type="radio" />
      <label for="radio01" class="radio_label">Yes</label>


And this works fine when adding a new record - HOWEVER when Edit Record is used to change this field, the changes aren't recognised. Any idea why?

thanks
GreyHead 26 Aug, 2009
Hi buckwheatpie,

Where aren't the changes recognised? There is nothing in your form html there to recognise which field is checked if that is what you want. You need to check the value and set the checked='checked' setting in the appropriate input.

Bob
buckwheatpie 01 Sep, 2009
OK - sorted - all i did was changed the "checked" to "checked='no'" and now it's working fine.

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