Forums

How to output results of radio buttons on email

RCheesley 03 Mar, 2010
Hi,

I might have missed something here, but I set up the emails by using the field insert function (which is great!) however my radio buttons are behaving rather strangely. On the emails they are outputting as follows:

Driving (this section is radio button)
Full Driving License
Own transport Own Transport
Penalty Points
Please give details of any penalty points nil (free text)
Are all your qualifications on your CV? (radio button)
yes Yes
yes No
Do you have any criminal convictions or cautions? (radio button)
no Yes
no No
Do you have any facial piercings or tattoos? (radio button)
no Yes
no No

As I'm sure you can appreciate the results above which were emailed from the form are somewhat confusing and contradictory - any suggestions?

Here is the rough format used in the emails (I have since updated some of the text but the principle remains the same):

Driving: Full License? {Full_license} Own transport? {Own_transport} Penalty points? {Penalty_points} Ever disqualified? {Ever_disqualified}
All qualifications on CV?: {radio14}

Criminal convictions or cautions?: {radio14}

Facial piercings or tattoos?: {radio14}

Ruth
RCheesley 03 Mar, 2010
NB I realise there are three instances of {radio14} however these are three separate radio button sets, and when I click on them in the email design wizard, they all return {radio14} - not sure why!!
GreyHead 03 Mar, 2010
Hi Ruth,

The ChronoForms Email Template generator isn't very clever when it comes to radio buttons and checkbox arrays.

But, even so, this format should be OK
All qualifications on CV?: {radio14}

So I suspect that something else is going on here. You certainly should not have multiple radio box groups with the same name.

Please can you post the Form HTML for this part of the form.

Bob
RCheesley 03 Mar, 2010
<div class="form_item">
  <div class="form_element cf_heading">
    <h3 class="cf_text">Driving</h3>
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_checkbox">
    <label class="cf_label" style="width: 150px;"></label>
    <div class="float_left">
      <input value="Full license" title="null" class="radio" id="Ever_disqualified0" name="Ever_disqualified" type="checkbox" />
      <label for="Ever_disqualified0" class="check_label">Full license</label>
      <br />
      
<input value="Own transport" title="null" class="radio" id="Ever_disqualified1" name="Ever_disqualified" type="checkbox" />
      <label for="Ever_disqualified1" class="check_label">Own transport</label>
      <br />
      
<input value="Penalty points" title="null" class="radio" id="Ever_disqualified2" name="Ever_disqualified" type="checkbox" />
      <label for="Ever_disqualified2" class="check_label">Penalty points</label>
      <br />
      
<input value="Ever disqualified" title="null" class="radio" id="Ever_disqualified3" name="Ever_disqualified" type="checkbox" />
      <label for="Ever_disqualified3" class="check_label">Ever disqualified</label>
      <br />
      

    </div>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text">Please give details of any penalty points or disqualifications</span> </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textarea">
    <label class="cf_label" style="width: 150px;"></label>
    <textarea class="cf_inputbox" rows="3" id="text_49" title="null" cols="30" name="text_49"></textarea>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text">Are all of your qualifications on your CV?</span> </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_radiobutton">
    <label class="cf_label" style="width: 150px;"></label>
    <div class="float_left">
      <input value="yes" title="null" class="radio validate-one-required" id="radio140" name="radio14" type="radio" />
      <label for="radio140" class="radio_label">yes</label>
      <br />
      
<input value="no" title="null" class="radio validate-one-required" id="radio141" name="radio14" type="radio" />
      <label for="radio141" class="radio_label">no</label>
      <br />
      

    </div>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text">If no, please give details</span> </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textarea">
    <label class="cf_label" style="width: 150px;"></label>
    <textarea class="cf_inputbox" rows="3" id="text_53" title="null" cols="30" name="text_53"></textarea>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text">Do you have any criminal convictions or cautions?</span> </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_radiobutton">
    <label class="cf_label" style="width: 150px;"></label>
    <div class="float_left">
      <input value="yes" title="null" class="radio validate-one-required" id="radio140" name="radio14" type="radio" />
      <label for="radio140" class="radio_label">yes</label>
      <br />
      
<input value="no" title="null" class="radio validate-one-required" id="radio141" name="radio14" type="radio" />
      <label for="radio141" class="radio_label">no</label>
      <br />
      

    </div>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text">Do you have any facial piercings or visible tattoos?</span> </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_radiobutton">
    <label class="cf_label" style="width: 150px;"></label>
    <div class="float_left">
      <input value="yes" title="null" class="radio validate-one-required" id="radio140" name="radio14" type="radio" />
      <label for="radio140" class="radio_label">yes</label>
      <br />
      
<input value="no" title="null" class="radio validate-one-required" id="radio141" name="radio14" type="radio" />
      <label for="radio141" class="radio_label">no</label>
      <br />
      

    </div>
    
  </div>
RCheesley 05 Mar, 2010
Any ideas how I can resolve this issue? It's pretty important as the forms are currently pretty useless!

Ruth
GreyHead 05 Mar, 2010
Hi Ruth,

There are two obvious and similar problems.

a) All of your checkbox fields use the same name so only the last one is being returned. These need to be array names name="Ever_disqualified[]"

b) All three sets of radio buttons use the same name, so only the value from the last set is returned and is applied to all three. Each set need to have a different name though each of the Yes/No inputs in the set can have the same name as only one will be selected.

Once those are corrected the default email template works OK - though you will need to add a label for the checkbox array.

Bob
RCheesley 05 Mar, 2010
OK I'll see what I can do - bear in mind that this was created using the Wizard, perhaps this needs to be looked at in a little more detail?

Is this something I can edit in the wizard or do I need to do it in the form html?

Ruth
GreyHead 05 Mar, 2010
Hi Ruth,

The checkboxes might well have been created with the Wizard, but the Wizard adds the correct array names (see the code below). I'm pretty certain that the duplicated radio button pairs also weren't created by the Wizard unless something very odd happened to the Wizard. They could have been copied and pasted though.

Bob

PS Here's the default Wizard code for a checkbox array name="check0[]" and two sets of radio buttons name="radio1" and name="radio2"
<div class="form_item">
  <div class="form_element cf_checkbox">
    <label class="cf_label" style="width: 150px;">Click Me to Edit</label>
    <div class="float_left">
      <input value="check 1" title="" class="radio" id="check00" name="check0[]" type="checkbox" />
      <label for="check00" class="check_label">check 1</label>
      <br />
<input value="check 2" title="" class="radio" id="check01" name="check0[]" type="checkbox" />
      <label for="check01" class="check_label">check 2</label>
      <br />
<input value="check 3" title="" class="radio" id="check02" name="check0[]" type="checkbox" />
      <label for="check02" class="check_label">check 3</label>
      <br />
    </div>
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_radiobutton">
    <label class="cf_label" style="width: 150px;">Click Me to Edit</label>
    <div class="float_left">
      <input value="radio 1" title="" class="radio" id="radio10" name="radio1" type="radio" />
      <label for="radio10" class="radio_label">radio 1</label>
      <br />
<input value="radio 2" title="" class="radio" id="radio11" name="radio1" type="radio" />
      <label for="radio11" class="radio_label">radio 2</label>
      <br />
<input value="radio 3" title="" class="radio" id="radio12"  natype="radio" />
      <label for="radio12" class="radio_label">radio 3</label>
      <br />
    </div>
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_radiobutton">
    <label class="cf_label" style="width: 150px;">Click Me to Edit</label>
    <div class="float_left">
      <input value="radio 1" title="" class="radio" id="radio20" name="radio2" type="radio" />
      <label for="radio20" class="radio_label">radio 1</label>
      <br />
<input value="radio 2" title="" class="radio" id="radio21" name="radio2" type="radio" />
      <label for="radio21" class="radio_label">radio 2</label>
      <br />
<input value="radio 3" title="" class="radio" id="radio22" name="radio2" type="radio" />
      <label for="radio22" class="radio_label">radio 3</label>
      <br />
    </div>
  </div>
  <div class="cfclear"> </div>
</div>
RCheesley 05 Mar, 2010
They most definitely came straight from the wizard. I rarely touch the form HTML.

See my bug report about the fact that it took me ~2 hours to create the form and then accidentally hit the save button rather than selected the element...so it took me ~3.5hrs to get the form working only to find that the results weren't being emailed properly .... needless to say, more than a little fed up with it by now!

Ruth
GreyHead 05 Mar, 2010
Hi Ruth,

Is this the current version of ChronoForms? If so then something is badly wrong because one of the problems it has is that you can't change the name of a checkbox array from the wizard or wizard edit. You can change the values and labels (together) but no the id or name.

Bob
RCheesley 10 Mar, 2010
Hiya,

Yes this is the current version, and I couldn't find anywhere to even see the ID of the checkbox/radio buttons.

Yes, something is seriously wrong. Yes I now have ~15 forms which my client can't use, which took me several hours to create, and which it seems I am going to have to go through and manually change the form HTML to make them work, if what you're saying is true.

I can give you back end access if you need to take a look at what is going on - I'm not very well at the moment so I am struggling even with the basic understanding of what you posted.

Ruth
GreyHead 10 Mar, 2010
Hi Ruth,

Plesae PM or Email me the site URL and a SuperAdmin login and I'll take a quick look.

Bob
RCheesley 11 Mar, 2010
Okies, just sent to you through the forum - thank you for your help, much appreciated.

Ruth
GreyHead 12 Mar, 2010
Hi Ruth,

I looked at the code from your form and the problems were exactly as I described in an earlier post. The checkbox group was not using an array name (the [] was missing) and there were two sets of repeated names for radio buttons: name='radio14' was used three times and name='radio20' twice.

There are some corresponding changes to the radio named in the template and the checkbox entry becomes Driving: {Ever_disqualified}

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