Jump to content
xisto Community
Sign in to follow this  
kvarnerexpress

Manipulating User Input From A Form

Recommended Posts

I have a HTML page with a form on it. I have an ASP page that processes what a user has entered into the form (updates a database etc). I now need a page that fits between these two pages to ?pre-process? the users input. I need to do it this way because I am not allowed to change either of the two existing pages.I know how to read what the user has input into the form and I know how to pass control onto the next page.What I have not been able to work out is how to change the user input and have those changes passed onto the next page as if nothing has happened (that is, the original ASP page just performs its request.form(?item?) calls as it always has but instead of seeing what the user actually typed in, it should see the changed text as created by the new ?pre process? page)I have tried using a regular expression replace but can only successfully make this change a variable and not the original form input. Equally I cannot find a way of swapping the original form input string with the output variable from the replace.Does anyone have any ideas on this one?Thanks in advance,

Share this post


Link to post
Share on other sites

To achieve your purpose, it depends on how your first page sending input data to the next page.

 

If the first page send the data to the next page via query string, it is easy. Just re-generate the query string is OK.

 

If the first page send the data to the next page via Session, it is also easy. You only need to modify the data and save it back to the Session...

 

If the first page send the data to the next page via form post method, you have to create some input fields or hidden fields in your middle page. Be ware that the fields should have the same id and name as those in the first page input fields. Then you only need to modify the data and set the fields value to the modifed data.

 

Then, you are done.

 

I have a HTML page with a form on it. I have an ASP page that processes what a user has entered into the form (updates a database etc).

 

I now need a page that fits between these two pages to ?pre-process? the users input. I need to do it this way because I am not allowed to change either of the two existing pages.

 

I know how to read what the user has input into the form and I know how to pass control onto the next page.

 

What I have not been able to work out is how to change the user input and have those changes passed onto the next page as if nothing has happened (that is, the original ASP page just performs its request.form(?item?) calls as it always has but instead of seeing what the user actually typed in, it should see the changed text as created by the new ?pre process? page)

 

I have tried using a regular expression replace but can only successfully make this change a variable and not the original form input. Equally I cannot find a way of swapping the original form input string with the output variable from the replace.

 

Does anyone have any ideas on this one?

 

Thanks in advance,

212212[/snapback]

Share this post


Link to post
Share on other sites

Do you want to use the response.redirect() method? if so then try this maybe:

response.redirect("newpage.asp?username="  & server.urlencode(request.form("username")) & "&password=" & server.urlencode(request.form("password"))
This grabs the form fields, URL-encodes them (to ensure that the browser doesn't choke on bad characters), and redirects to the next page with the URL-encoded variables in the querystring of the next page. Feel free to tinker with this.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.