Forums

ASP

This topic is locked

Radio Buttons with repeat region

Posted 15 Aug 2006 05:11:29
1
has voted
15 Aug 2006 05:11:29 lou castro posted:
I am working on my football pool website...here's my dilemma. I have a recordset with week 1's schedule. Fields are Hometeam awayteam and Spread. I have a repeat region to show all 16 games. I need users to pick each game with a radio button, but I cant find a way to modify the radio button so that there are 16 different radio buttons.
I know I have to name each radio button differently, so each game gets stored in the database.
Please help! I dont want to manually list all 16 games (since its already in a schedule table).
Thank you!

Replies

Replied 17 Aug 2006 01:39:01
17 Aug 2006 01:39:01 lou castro replied:
Does anyone have an idea?
Replied 17 Aug 2006 18:38:15
17 Aug 2006 18:38:15 Dan Berdusco replied:
You can name each radio button differently by simply adding a number to the name of each radio button. Within your repeat region loop, you can have a number that counts up and add it to the name of the radio button. Something like this:

<pre id=code><font face=courier size=2 id=code>&lt;form name="form1" method="post" action=""&gt;

&lt;%
&lt;!--
VarCountNum = 1
--&gt;
%&gt;

&lt;%
While ((Repeat1__numRows &lt;&gt; 0) AND (NOT Recordset_name.EOF))
%&gt;

&lt;input name="radioBut&lt;%=VarCountNum%&gt;" type="radio" value="radiobutton"&gt;

&lt;%
&lt;!--
VarCountNum = VarCountNum + 1
--&gt;
%&gt;

&lt;%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset_name.MoveNext()
Wend
%&gt;

&lt;/form&gt; </font id=code></pre id=code>

Hope that helps...

Edited by - flexman44 on 17 Aug 2006 18:39:39
Replied 19 Aug 2006 17:17:13
19 Aug 2006 17:17:13 lou castro replied:
Awesome idea...thank you. How about assigning teh values for each button. Where can I define that?
Example:
radio#1 values could be team1 or team2
radio#2 values could be team3 or team 4

and so on...

Reply to this topic