PDA

View Full Version : How can i pass values after using back button?


lovesirius12
12-12-2005, 07:52 AM
here's the situation: in the first page, let's say registration page, i put fields for last name, first name and address. then when submitted, it goes to Checking page, it checks if the user had entered the required fields, and if a field was blank, it do this:

<script language="JavaScript">
window.history.back();
</script>

it goes back, alright but i cannot pass a value so i can tell the user which field he/she missed.

I've done redirecting before but all the text boxes were erased and its not nice. please help me.

i also tried putting a hidden input just before the code above, thus:

<input type="hidden" name="warn" value="lname">
<script language="JavaScript">
window.history.back();
</script>

it still doesnt work. please help. thanks.

BarrMan
12-12-2005, 02:22 PM
I think you'd better use the response.redirect function if you know the specific place you want to go like:
Response.Redirect "Page.asp?value1=value1&value2=value2&value3=value3"
This function immediately transfers you to the selected place.

oracleguy
12-12-2005, 10:58 PM
Yeah you can't really pass any values back to a page when telling the browser to go back like that. What you'd need to use is pass the values for all the fields back to the page along with any error codes/messages.

degsy
12-13-2005, 04:10 PM
If you use javascript back method then it should just bring up the page from the internet cache with the previous values still inplace, except for password fields.
This is unless you are using cache prevention in your pages.


Yeah you can't really pass any values back to a page when telling the browser to go back like that. What you'd need to use is pass the values for all the fields back to the page along with any error codes/messages.
or if you have the form as an include or function then you can include it on the checking page.

Deekman
12-14-2005, 12:11 AM
You could save them in a session when the users submits the form and then in the boxes on the page write if statements for the values that say something like
if session(whatever) = true then
response.write(session(whatever))
end if

That's the theory anyway.
Obviously not the right code but good enough for an example