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!

Radio button and CDONTS

Status
Not open for further replies.
Mar 14, 2002
711
US
I have an issue passing the value of a radio button from a form to email using CDONTS. It will pass all the other text fields, but it skips over the radio buttons. This is the code for the radio button on the forms page:

<input type="radio" value="radSold" name="R1">

And then on the ASP page that handles the form, it looks like this:

strSold = Request.Form("radSold")

Dim strBody
strBody = strHeader & ( vbCrLf & vbCrLf )
strBody = strBody & ( "" & strFrom & vbCrLf ) & _
( "FORM submitted at " & Now() & vbCrLf & vbCrLf )

dim ix, formElementName, formElementValue, prefix, fldName
For ix = 1 to Request.Form.Count
formElementName = Request.Form.Key(ix)
formElementValue = Request.Form.Item(ix)

' what type of field was that on the form?
prefix = Left(formElementName,3)

' and throw away prefix to get actual field name
fldName = Mid(formElementName,4)

' but change periods to spaces for readability
fldName = Replace(fldName, "."," ")

Select Case prefix
' if the prefix indicates this is a form field of interest...
Case "txt","sel","rad","cbo","lst","chk":
' if user didn't answer this question, say so...


' then tack on the name of the field and the answer
strBody = strBody & (fldName & ": " & formElementValue & vbCrLf & vbcrlf)
End Select
Next

strBody = strBody

'Time to send the email
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.To = strTo
objCDO.cc = strEmail
objCDO.From = strEmail

objCDO.Subject = strSubject
objCDO.Body = strBody

objCDO.Send

Set objCDO = Nothing

And of course, the variables are declared at the top of the ASP page, etc.

Any ideas as to why it will not pass the radio button value?
 
I think I have the problem. It should be

strSold = Request.Form("R1")

rsshetty.

It's always in the details.
 
:-( that did not work either....it is like it does not even see the radio buttons...
 
I think I got it.

make your form method=post.

rsshetty.

It's always in the details.
 
It does post....I am going to try using checkboxes instead, see if that makes any difference...
 
Are you sure the users are actually selecting one of the radio buttons? Are you forcing one of the buttons to be checked by default, using the "checked" attribute? I'm using almost identical code on several forms, and the radio buttons work for me.

Good luck

Jerry
 
I made one modification, I tested with a checkbox, and then I used the same mode for my radio buttons, i.e. cboTXTFIELDNAME, and that did the trick :) , thanks for all your help on this!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top