Syntax for Request.From with Variable??
am 19.08.2006 15:22:43 von Mal Reeve
Hello,
I'm trying to loop through a response form, read the value of a given
response....then later write it to a database.
I am having problems with the following code...and am thinking that I have a
problem with the syntax of reading the form response.
Code is as follows.......(Cause a "This page cannot be displayed error")
Each form field is named q1 through q51 etc..
Any Advice?
Mal.
------------------------------------------------------------ -----------------------------------
For i = StartNum to EndNum ' Test for numeric (radio Group) or text
answer given and assign query params
QName = "q" & i
Response.Write "QName: " & QName
Response.Write(Request.Form(QName)) &" --FormData--
"
Response.Write "NUMERIC?: " & isnumeric(request.form(QName) &"
"
if IsNumeric(Request.(QName) then
Form_NumAnswer = request.form(QName)
Form_TxtAnswer = ""
else
Form_TxtAnswer = request.form(QName)
Form_NumAnswer = null
end if
response.Write i & " - TXT: " & Form_TxtAnswer & "
"
response.Write i & " - NUM: " & NZ(Form_NumAnswer,"") & "
"
next
Re: Syntax for Request.From with Variable??
am 19.08.2006 16:12:27 von reb01501
Mal Reeve wrote:
> Hello,
>
> I'm trying to loop through a response form, read the value of a given
> response....then later write it to a database.
>
> I am having problems with the following code...and am thinking that I
> have a problem with the syntax of reading the form response.
>
> Code is as follows.......(Cause a "This page cannot be displayed
> error")
> Each form field is named q1 through q51 etc..
>
> Any Advice?
Show us the real error:
http://www.aspfaq.com/show.asp?id=2109
> ------------------------------------------------------------ -----------------------------------
> For i = StartNum to EndNum ' Test for numeric (radio Group) or
> text answer given and assign query params
>
> QName = "q" & i
> Response.Write "QName: " & QName
> Response.Write(Request.Form(QName)) &" --FormData--
"
> Response.Write "NUMERIC?: " & isnumeric(request.form(QName) &"
"
Why are you testing whether the value is numeric before testing that you
even HAVE a value?
Dim val
val=Request.Form(QName)
if len(val) > 0 then
....
else
'no value for supplied variable - let's check the form collection:
for each key ion response.form
response.write key & ": " & request.form(key) & "
"
next
end if
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Re: Syntax for Request.From with Variable??
am 19.08.2006 18:43:06 von mmcginty
"Mal Reeve" wrote in message
news:DgEFg.8090$Qf.1002@newsread2.news.pas.earthlink.net...
> Hello,
>
> I'm trying to loop through a response form, read the value of a given
> response....then later write it to a database.
>
> I am having problems with the following code...and am thinking that I have
> a problem with the syntax of reading the form response.
>
> Code is as follows.......(Cause a "This page cannot be displayed error")
> Each form field is named q1 through q51 etc..
>
> Any Advice?
> Mal.
> ------------------------------------------------------------ -----------------------------------
> For i = StartNum to EndNum ' Test for numeric (radio Group) or text
> answer given and assign query params
>
> QName = "q" & i
> Response.Write "QName: " & QName
> Response.Write(Request.Form(QName)) &" --FormData--
"
> Response.Write "NUMERIC?: " & isnumeric(request.form(QName) &"
"
Syntax error in line above, no closing paren for isnumeric.
> if IsNumeric(Request.(QName) then
Same here.
-Mark
> Form_NumAnswer = request.form(QName)
> Form_TxtAnswer = ""
> else
> Form_TxtAnswer = request.form(QName)
> Form_NumAnswer = null
> end if
>
> response.Write i & " - TXT: " & Form_TxtAnswer & "
"
> response.Write i & " - NUM: " & NZ(Form_NumAnswer,"") & "
"
>
> next
>