Print Page | Close Window

re-populate formfield when user hits back

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: General Discussion
Forum Description: General discussion and chat on any topic.
URL: https://forums.webwiz.net/forum_posts.asp?TID=5724
Printed Date: 30 March 2026 at 1:18am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: re-populate formfield when user hits back
Posted By: dizzyfunk
Subject: re-populate formfield when user hits back
Date Posted: 13 September 2003 at 4:23am

i have a BIG for that send to an asp process page which checks validation on formfields.

if formfields incorrect then the page redirects back to the form page with an error message.

how can i get the form to re-populate itself with the data that was entered to it?

i can't use the GET method for the form as it creates a querystring more than 255 characters!!

HELP!




Replies:
Posted By: KCWebMonkey
Date Posted: 13 September 2003 at 8:22am

on the validation page, store each value in a variable using

strVar1 = Request.Form("input1")
strVar2 = Request.Form("input2")

and so on... then in the code that redirects back to the form use a querystring

Response.Redirect ("form.asp?input1=strVar1&input2=strVar2")

back on the form page you have to store the valus into a variable again using

input1 = Request.QueryString("input1")
input2 = Request.QueryString("input2")

Then in the form you have to use the variables in the value fields

<input type="text" name="input1" value="<%=input1%>">

__________________________________________________________

That's one way to do it.



Posted By: dizzyfunk
Date Posted: 13 September 2003 at 8:32am

will this work if the querystring is about 4 miles long?

 



Posted By: KCWebMonkey
Date Posted: 13 September 2003 at 12:45pm
I don't see why not... that's the easiest solution unless you want to use a database.


Posted By: ljamal
Date Posted: 13 September 2003 at 2:00pm
Originally posted by dizzyfunk dizzyfunk wrote:

will this work if the querystring is about 4 miles long?


 



No.
The querystring can only store a limited amount of data.

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: KCWebMonkey
Date Posted: 13 September 2003 at 2:27pm

I guess for IE 5&6 the limit is 2,048 characters, but if you need more than that you might use a db.



Posted By: dizzyfunk
Date Posted: 14 September 2003 at 3:09am

it's cool... in my amateurish way of trying to be all clever with ASP..

 

i totally forgot about validating the form using javascript on the form page itself!!

 

many thanks for the replies!



Posted By: Bluefrog
Date Posted: 19 September 2003 at 9:07am

I'm actually about to do the same thing myself over the weekend. I've only got one textarea though, and I'm going to be using it for users to change things - i.e. Go back on a user action.

I'm planning on using a button to POST back to the previous page. I won't actually need hidden fields because I'll use a component to HEAD everything back to the original page. That way I'll scoot around GET, which is poor, and I'll also get around having to use hidden fields.

I'll try to post some of it back later when I've got it done.

BTW: you can also do automatic redirection the way I'm planning, but I'll post it later when it's done.

 



Posted By: Diep-Vriezer
Date Posted: 21 September 2003 at 3:26am
Or make an Asp.net page. This one has much easier validation wich is all server done.

-------------
Gone..


Posted By: Bluefrog
Date Posted: 28 September 2003 at 6:30am

ok... back...

On the page where the original form is, put something like this

    For Each formItem In Request.Form
  
               myVar=formItem & " = """ & trim(Request.Form(formItem)) & """ "

  execute(myVar)
    Next

The in the inputs on your page, put:

value="<%=theItemName%>"

In the post to page, put hidden inputs and add in an "edit" or "back" button:

<INPUT TYPE="submit"  OnClick="this.form.action=original_form_page.asp';" value="Edit Info">

Now, it's all done

My implementation was a bit more complex, but nothing worth mentioning.

Sorry about taking to long to get back here - I got swamped with work and that part was a low priority.

 



-------------
http://renegademinds.com/" rel="nofollow - Renegade Minds - Guitar Software http://renegademinds.com/Default.aspx?tabid=65" rel="nofollow - Slow Down Music



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net