Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with dynamic radio boxes 1

Status
Not open for further replies.

OccasionalCoder

Technical User
Sep 26, 2005
36
US
Here's the code I use to select the checked radio box when I pull the form info from a simple database:

<cfif get_data.status eq "current">
Current: <input type="radio" name="status" value="current" checked>
Past: <input type="radio" name="status" value="past">
<cfelse><br>

Current: <input type="radio" name="status" value="current">
Past: <input type="radio" name="status" value="past" checked>
</cfif>


When my query returns only 1 record, the radio box works correctly.

In an instance where there were 4 records returned, the radio boxes are empty for the first 3 and the last one is correct.

I don't understand why this doesn't work when there are multiple records returned.

Thanks for all help
 
you need to make sure the radio button code is in a loop to loop over all of the data.

This can be accomplished with a
<cfoutput query="test">
radio button code
</cfoutput>

OR

<cfloop query="test">
radio button code
</cfloop

Mike
 
Thanks for the help.

Actually the code works as is...I had the <cfoutput> </cfoutput> tags in the wrong place. When I enclosed the form in its entirety within those tags, it worked fine.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top