Radio / Checkbox Output - Doubling Up!

VikkiB 20 Jun, 2007
Hi all,

I'm using chronoforms to do a fairly basic customer feedback form for my Dad's site.

We are asking a series of questions with a 'yes' or 'no' option.


Initially I used this:
------------------------------------------------------------
Would you recommend us to friends/family?
</TD>
<TD WIDTH="210"></TD>
<TD>
<input type="radio" name="recommend" value="Yes" /> Yes <input type="radio" value="No" />No
------------------------------------------------------------


However, this would only return an answer if the 'yes' option was selected. A blank would appear if the customer selected 'no' OR chose not to answer the question.



So I changed it to this:
------------------------------------------------------------
Would you recommend us to friends/family?
</TD>
<TD WIDTH="210"></TD>
<TD>
<input type="radio" name="recommend" value="Yes" /> Yes <input type="radio" name="recommend" value="No" />No
------------------------------------------------------------


I just added the name to the 'no' option as well as the 'yes' option.


This has solved the blanks vs 'no' problem as it is now clear whether the answer is 'yes', 'no' or left blank.

But in the output email I now get two identical lines for each question wether the answe ris 'yes', 'no' or left blank:
------------------------------------------------------------
Would_you_recommend_us Yes
Would_you_recommend_us Yes
------------------------------------------------------------

Can anyone suggest how I can just getone line with whichever response is appropriate? B)

TY in advance!

Vikki
GreyHead 20 Jun, 2007
Hi VikkiB,

With radio buttons (and checkboxes) only the 'on' or 'yes' results are sent back with the form info (so you won't get 'no' info directly from the form though I imagine that you could change this with JavaScript . . .)

One way to make sure that you get an answer is to use radio buttons but to pre-set one of them with a checked='checked' attribute.

Your first example isn't valid because the 'name' attribute is required I'd guess that entry was just being ignored.

And I think that you are getting two lines in your reply because ChronoForms scans the html to find all the field names and create a list including the duplicates. However, there is only one piece of data returned for a radio button and that gets applied to both fields. What I don't know is why that is always 'Yes' I'd need to look at the form and dig some more to answer that. If you like, can you paste the whole form html from the ChronoForms box here - if you do it between
 and 
tags then it will look a little neater.

Bob
VikkiB 20 Jun, 2007
Bob, many thanks for taking the time to respond.

Since I added the second 'name' in the no option I do actually get a 'no' response returned in the output email. I've attached a screenshot of the first half of the form (before the text input bits).

This is the code:


<HTML>
<BODY>
<BR><BR>
<CENTER>
<FONT FACE=ARIAL FONT COLOR="#010080" SIZE=6>
<B>CUSTOMER FEEDBACK FORM</B>
<BR><BR>
<FONT FACE=ARIAL FONT COLOR="#010080" SIZE=4>
We want you to be delighted with the work we do for you. 
<BR><BR>
To ensure we continue to acheive this please take a 
<BR>
moment to complete this feedback form.
<BR><BR><BR>
</CENTER>
<TABLE>
<TR>
<TD>
<FONT FACE=ARIAL FONT COLOR="#010080" SIZE=3>
<B>Did we do what we promised to do?</B>
</TD>
</TR>
<TR>
<TD>
Did we arrive on time?
</TD>
<TD WIDTH="42"></TD>
<TD>
<input type="radio" name="ontime" value="Yes" />Yes<input type="radio" name="ontime" value="No" />No
</TD>
</TR>
<TR>
<TD>
Did we use dust sheets to protect floors, furniture etc?
</TD>
<TD></TD>
<TD>
<input type="radio" name="dustsheets" value="Yes" />Yes<input type="radio" name="dustsheets" value="No" />No
</TD>
</TR>
<TR>
<TD>
Were we always polite and curteous?
</TD>
<TD></TD>
<TD>
<input type="radio" name="polite" value="Yes" />Yes<input type="radio" name="polite" value="No" />No
</TD>
</TR>
<TR>
<TD>
Did we always use good quality Materials? (i.e. Dulux Paints)
</TD>
<TD></TD>
<TD>
<input type="radio" name="materials" value="Yes" />Yes<input type="radio" name="materials" value="No" />No
</TD>
</TR>
<TR>
<TD>
Did we carry out a final check of the work with you at the end of the job?
</TD>
<TD></TD>
<TD>
<input type="radio" name="finalcheck" value="Yes" />Yes<input type="radio" name="finalcheck" value="No" />No
</TD>
</TR>
<TR>
<TD>
Did we leave your property clean and tidy?
</TD>
<TD></TD>
<TD>
<input type="radio" name="tidy" value="Yes" />Yes<input type="radio" name="tidy" value="No" />No
</TD>
</TR>
<TR>
<TD>
Did we remove all waste/rubbish?
</TD>
<TD></TD>
<TD>
<input type="radio" name="waste" value="Yes" />Yes<input type="radio" name="waste" value="No" />No
</TD>
</TR>
</TABLE>

<BR><BR>
<TABLE>
<TR>
<TD>
<FONT FACE=ARIAL FONT COLOR="#010080" SIZE=3>
<B>How would you describe the work we did for you?</B>
</TD>
</TR>
<TR>
<TD>
"I cannot fault the work and I would definitely use your services again."
</TD>
<TD>
<input type="radio" name="cannotfault" value="Yes" /> Yes <input type="radio" name="cannotfault" value="No" />No
</TD>
</TR>
<TR>
<TD>
"I am pleased with the work and would consider using your services again."
</TD>
<TD>
<input type="radio" name="consideragain" value="Yes" /> Yes <input type="radio" name="consideragain" value="No" />No
</TD>
</TR>
<TR>
<TD>
"I am not happy with the work and would not consider using your services again."
</TD>
<TD>
<input type="radio" name="notconsider" value="Yes" /> Yes <input type="radio" name="notconsider" value="No" />No
</TD>
</TR>
</TABLE>

<BR><BR>
<TABLE>
<TR>
<TD>
<FONT FACE=ARIAL FONT COLOR="#010080" SIZE=3>
<B>Recommendations</B>
</TD>
</TR>
<TR>
<TD>
Would you recommend us to friends/family?
</TD>
<TD WIDTH="210"></TD>
<TD>
<input type="radio" name="recommend" value="Yes" /> Yes <input type="radio" name="recommend" value="No" />No
</TD>
</TR>
</TABLE>

<BR><BR>

<CENTER>

<TABLE>
<TR>
<TD ALIGN="CENTER">
<FONT FACE=ARIAL FONT COLOR="#010080" SIZE=3>
<B>Please feel free to make any additional comments</B>
</TD>
</TR>
<TR>
<TD>
<textarea cols="60" rows="6" name="comments"></textarea>
</TD>
</TR>
</TABLE>

</CENTER>

<BR><BR>


<FONT FACE=ARIAL FONT COLOR="#010080" SIZE=4>
<CENTER>
Many thanks for taking the time to complete our feedback form.
<BR><BR>
A <B>£20 OFF</B> next order voucher will be sent to you as a 'Thank You'.
<BR><BR>
Please provide your name and address below so that we can send you 
<BR>
the voucher.  Alternatively you can submit your feedback anonymously.
<BR><BR><BR><BR>

</CENTER>

<TABLE>
<TR>
	<TD WIDTH="120"></TD>	
	<TD>
	<FONT FACE=ARIAL FONT COLOR="#010080" SIZE=3>
	Title
	</TD>
	<TD WIDTH="25"></TD>
	<TD><input type="text" name="title">
	</TD>
</TR>
<TR>
	<TD WIDTH="120"></TD>
	<TD>
	<FONT FACE=ARIAL FONT COLOR="#010080" SIZE=3>
	First Name
	</TD>
	<TD></TD>
	<TD><input type="text" name="firstname">
	</TD>
</TR>
<TR>
	<TD WIDTH="120"></TD>
	<TD>
	<FONT FACE=ARIAL FONT COLOR="#010080" SIZE=3>
	Last Name
	</TD>
	<TD></TD>
	<TD><input type="text" name="lastname">
	</TD>
</TR>
<TR>
	<TD WIDTH="120"></TD>
	<TD>
	<FONT FACE=ARIAL FONT COLOR="#010080" SIZE=3>
	Address Line 1
	</TD>
	<TD></TD>
	<TD><input type="text" name="add1">
	</TD>
</TR>
<TR>
	<TD WIDTH="120"></TD>
	<TD>
	<FONT FACE=ARIAL FONT COLOR="#010080" SIZE=3>
	Address Line 2
	</TD>
	<TD></TD>
	<TD><input type="text" name="add2">
	</TD>
</TR>
<TR>
	<TD WIDTH="120"></TD>
	<TD>
	<FONT FACE=ARIAL FONT COLOR="#010080" SIZE=3>
	Town
	</TD>
	<TD></TD>
	<TD><input type="text" name="add3">
	</TD>
</TR>
<TR>
	<TD WIDTH="120"></TD>
	<TD>
	<FONT FACE=ARIAL FONT COLOR="#010080" SIZE=3>
	County
	</TD>
	<TD></TD>
	<TD><input type="text" name="add4">
	</TD>
</TR>
<TR>
	<TD WIDTH="120"></TD>
	<TD>
	<FONT FACE=ARIAL FONT COLOR="#010080" SIZE=3>
	Postcode
	</TD>
	<TD></TD>
	<TD><input type="text" name="postcode">
	</TD>
</TR>
</TABLE>

<BR><BR><BR>

<CENTER>
<FONT FACE=ARIAL FONT COLOR="#010080" SIZE=4>
Please tick here if you <B>do not</B> want us to use your comments in future promotional material 
<input type="checkbox" name="donotuse" value="Yes" />

<BR><BR><BR><BR>
<input type="submit" value="Send">
<BR><BR><BR><BR><BR><BR>


</BODY>
</HTML>
Radio / Checkbox Output - Doubling Up! image 1<br><br>Post edited by: VikkiB, at: 2007/06/20 19:23
GreyHead 20 Jun, 2007
Hi VikkiB,

That fits with what I'd expect. I look in a while and see if there's a simple hack that will remove the duplicates for you.

Bob
VikkiB 21 Jun, 2007
:cheer:

Many, many thanks, Bob!
Max_admin 21 Jun, 2007
Hi Vikki,

Can you use the email template option to get the email with only 1 value you want ?

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
VikkiB 21 Jun, 2007
tbh, Max, I haven't tried doing anything with the email template option yet... I'll have a search around the forums to see what it's about! ; )
GreyHead 21 Jun, 2007
Hi Vikki,

The code 'ought' to be stripping out the duplicates. I don't immediately see why it isn't. I'll create a test form in the morning - it's late here now.

Bob
GreyHead 21 Jun, 2007
Hi Vikki,

I ran a test with your code on ChronoForms v2.0 and everything appears to be OK. I don't get any duplicates. See the sample output in the image (I only used the radio buttons). Is your page live on the net?

Bob
Radio / Checkbox Output - Doubling Up! image 2<br><br>Post edited by: GreyHead, at: 2007/06/21 07:44
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger