Gossamer Forum
Home : Products : Links 2.0 : Customization :

How to display which radio button is checked

Quote Reply
How to display which radio button is checked
Hi all,

My next question, (not another one Tongue), doesn't regard links directly, but seeing as you are all so helpful, I thought I would start here first.

I have added some radio buttons, which offer the user the option to select colour, font type etc for their detailed page. The challenge I have at the momet is getting the the correct button to be displayed as checked on the add_error page. So for example if the colour red was selected and an error was made on the page, when the add_eror page loads, none of my radio buttuns are selected. I have included the html that I have tried, but doesn't seem to work:

<td colspan="7">
<input name="header font type" type="radio" value="Arial" <%if Arial%>checked<%endif%>>
<font face="Arial, Helvetica, sans-serif"> Arial</font> <input type="radio" name="header font type" value="Times" <%if Times%>checked<%endif%>>
<font face="Times New Roman, Times, serif">Times</font> <input type="radio" name="header font type" value="Verdana"<%if Verdana%>checked<%endif%>>
<font face="Verdana, Arial, Helvetica, sans-serif">Verdana</font></td>

Can anyone point me in the right direction.

Thanks in advance
Hamsterpants
Quote Reply
Re: [Hamsterpants] How to display which radio button is checked In reply to
try

Code:


<TR>
<TD colspan="7">
<INPUT type="radio" name="header font type" value="Arial" <%if 'header font type'=Arial%> checked<%endif%>>
<FONT face="Arial, Helvetica, sans-serif">Arial</FONT>
<INPUT type="radio" name="header font type" value="Times" <%if 'header font type'=Times%> checked<%endif%>>
<FONT face="Times New Roman, Times, serif">Times</FONT>
<INPUT type="radio" name="header font type" value="Verdana" <%if 'header font type'=Verdana%> checked<%endif%>>
<FONT face="Verdana, Arial, Helvetica, sans-serif">Verdana</FONT>
</TD>
</TR>


you may have to delete those spaces in 'header font type' = header_font_type or headerfonttype. I know Perl allows spaces in field names but they can cause problems.


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [esm] How to display which radio button is checked In reply to
Thanks Gene for looking at this for me, tried your suggestion, but that didn't work...any other ideas?

Thanks
Hamsterpants
Quote Reply
Re: [Hamsterpants] How to display which radio button is checked In reply to
sorry about that:

Code:
<TR>
<TD colspan="7">
<INPUT type="radio" name="header font type" value="Arial" <%if header_font_type' eq 'Arial'%> checked<%endif%>>
<FONT face="Arial, Helvetica, sans-serif">Arial</FONT>
<INPUT type="radio" name="header font type" value="Times" <%if header_font_type' eq 'Times'%> checked<%endif%>>
<FONT face="Times New Roman, Times, serif">Times</FONT>
<INPUT type="radio" name="header font type" value="Verdana" <%if header_font_type eq 'Verdana'%> checked<%endif%>>
<FONT face="Verdana, Arial, Helvetica, sans-serif">Verdana</FONT>
</TD>
</TR>


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [esm] How to display which radio button is checked In reply to
Hi Gene,

Had to tweak one or two things, but you put me on the right track, so thanks very much for your help, Html that works for me incase you may be interested below:

<tr>
<TD colspan="2"><INPUT name="header_font_type" type="radio" value="Arial" <%if header_font_type eq Arial%> checked<%endif%>>
<FONT face="Arial, Helvetica, sans-serif">Arial</FONT> <INPUT type="radio" name= 'header_font_type' value="Times" <%if header_font_type eq Times%> checked<%endif%>>
<FONT face="Times New Roman, Times, serif">Times</FONT> <INPUT type="radio" name="header_font_type" value="Verdana" <%if header_font_type eq Verdana%> checked<%endif%>>
<FONT face="Verdana, Arial, Helvetica, sans-serif">Verdana</FONT>
</TD>
</tr>

Thanks again
Hamsterpants
Quote Reply
Re: [Hamsterpants] How to display which radio button is checked In reply to
now you see why I hate them spaces! Frown

glad you got it to work.


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."