I'm very new to ASP and I'm trying to get a radio button group to work and it doesn't. Here's what I have:

If Request.Form("RadioGroup1")(1) <> "" Then messBody = messBody & "New" & vbCrLf & vbCrLf

If Request.Form("RadioGroup1")(2) <> "" Then messBody = messBody & "Used"  & vbCrLf & vbCrLf

If Request.Form("RadioGroup1")(3) <> "" Then messBody = messBody & "Remanufactured"  & vbCrLf & vbCrLf

If Request.Form("RadioGroup1")(4) <> "" Then messBody = messBody & "Manufacturing"  & vbCrLf & vbCrLf

here is my html button code:

<label>
                                      <input type="radio" checked="checked" value="New" 
                        name="RadioGroup1" />
                                      New</label>
                                    <label> <br />
                                    <input 
                        type="radio" value="Used" name="RadioGroup1" />
                                      Used<br />
                                    </label>
                                    <label>
                                      <input type="radio" 
                        value="Remanufactured" name="RadioGroup1" />
                                      Remanufactured</label>
                                      <label><br />
                                        <input type="radio" 
                        value="Manufacturing" name="RadioGroup1" />
                                        Manufacturing</label>

how that makes sense. thank you

You are trying to capture an array in your request statement and you have not setup an array in your value settings. You will have to use an if/else statement to capture the values, given they are string values.

i.e. ( If Request.Form("RadioGroup1") = "New" then )
... what it is supposed to do
..... ( elseif Request.Form("RadioGroup1") = "Used" then )
... what it is supposed to do
..... etc..

..... ( end if )

Whenever you try to capture an array, the value must always include an array definition. i.e. value="arrayName()"

I hope this helps.

I think you can try following code to solve your problem.

Dim temp 
temp = Request.Form("RadioGroup1")
If temp <> "" Then
	messBody = messBody & temp & vbCrLf & vbCrLf
End If

If on selection of different radio button you want to handle it differently then you can try SELECT Case also.

Dim temp 
temp = Request.Form("RadioGroup1")
Select Case temp
	Case "New"
		do something
	Case "Used"
		do something 
	Case "Remanufactured"
		do something 
	Case "Manufacturing"
		do something 
	Case Else
		do something
End Select
This article has been dead for over six months. Start a new discussion instead.