Click to See Complete Forum and Search --> : Resetting request.form value


jimr451
03-29-2004, 08:57 AM
Hi,

I've searched high and low, and no luck on this one. I was thinking it'd be simple, but nothing I've tried seems to work.

Here it is:

I'm modifying a vbscript (written by someone else) and for a change I need to make, it would be extremely helpful if I could change a value in the "request.form" collection.

So, I get a value "x" from the form, stored like so:

request.form("x")

I'd like to set that to a different value, based on some logic in the script, since the collection is used later to build a SQL query. So I'd like to do something like:

request.form("x") = "Hello"

But so far, the syntax eludes me. Can someone help?

Thanks,

-Jim

buntine
03-29-2004, 09:21 AM
...And herein lies the advantage of run-time variables, my friend. ;)

You cannot, or should not, alter the value of the Request.form() collection members without reloading the document.

You will need to store the value in a variable and then alter the value of the variable as needed.

Dim intX
strX = CStr(Request.form("x"))

With Response
.Write("X = " & strX & "<br />" & vbCrLf)
strX = "New value"
.Write ("X = " & strX & "<br />" & vbCrLf)
End With


Regards,
Andrew Buntine.

buntine
03-29-2004, 09:46 AM
By the way, im not sure how much knowledge you have of ASP and i dont mean to insult your intelligence -- but if you dont understand what i am talking about -- or you dont quite get something in the preceding code snippet, just ask and i will explain it in more detail.

Regards.

jimr451
03-29-2004, 09:55 AM
Thanks for the quick response - it'll save me more wasted time searching.

I'll use some different logic to do what I need to do.

Thanks!

-Jim