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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie needs radio button help

Status
Not open for further replies.

benniesanders

Programmer
Jan 20, 2002
199
US
Hi all,

I'm somewhat of a newbie and needed some tips but didn't know how to search FAQs for the answer. I have a form with fields from a recordset that I loop through and two radio buttons. Button value=1 and button value=2. I have to name the buttons after one of the fields in the recordset so they will be unique on each row and I have a possible 30 rows. My quandry is, how to I capture the value of the radio buttons in the next page the form is submitted to since the button names are record names? Thanks in advance for your help.

 
To output the names and values of all your form objects, you can use the following:

dim i
for i = 0 to request.form.count
response.write(&quot;The value of:<br>&quot;)
response.write(request.form.key(i))
response.write(&quot;<br>is<br>&quot;)
response.write(request.form(i))
response.write(&quot;<br><br>&quot;)
next

You can use the same logic to do whatever you need to with it. If simply writing it to the screen isn't what you want, then store them in variables, or whatever.

:)
paul

penny.gif
penny.gif
 
Hi Paul,

Thanks so much for the reply. I am getting the following error:

The value of:

Request object error 'ASP 0105 : 80004005'

Index out of range

/form2.asp, line 54

An array index is out of range.

I've tried to fix it but to no avail. If you have any thoughts, I'd appreciate the input. Thanks.

Ultimately the value will be inserted into a sql table.

 
Paul, spoke too soon. I changed the 0 to 1 and it worked. Only thing is, I can't figure out how to insert it into the database table. If you can spare some smarts, I'd be appreciative. Thanks again for your time.
 
Hi Paul,

Spoke too soon again! I figured it out. It's not pretty and there is probably a cleaner way to do it but it works. Here's what I did:

dim i
for i = 1 to request.form.count
if isnumeric(Request.Form.Key(i)) then
memnum=Request.Form.Key(i)
else
end if
value=(request.form(i))
if value=&quot;1&quot; then
newvalue=&quot;1&quot;
else
if value=&quot;2&quot; then
newvalue=&quot;2&quot;
end if
end if
objConn.execute(&quot;Update statement here&quot;)
next

Thanks so much for your directions. I truly appreciate it.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top