nicks60610
MIS
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?
<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?