View Full Version : Edit History Page?
mizroo
03-10-2003, 07:29 AM
hi,
I have a little problem.
I have 1 asp page which will display textboxes for User to fill in their personal particulars and refreshes when they select a category via the drop down menu. The refreshing page will then display the initially hidden parts of the form, according to the category User has chosen.
However, when the User hits the back button, the browser will go back to the 'previous' page and the selection in the drop down menu will be reflected as the one the User had chosen previously. And should the User submit the form, the validation is bypassed and the form will be submitted with no details of the category they had chosen.
I had tried the history.forward() method, but my supervisor doesn't approve of it because, the User will not be able to go back to the page after submitting the form. She wants the form to have easy navigation using the back and forward buttons.
Here's the website, the page itself is a working one already, just that there's some minor errors if the User decides to click 'back' and thus we will not be able to receive the data.
http://asp.airfares.com.sg/Bookings_Online/GenSeller.asp
thanks so much! :o
tis my first post actually.
whammy
03-11-2003, 02:11 AM
I filled out your form, and when I hit the back button, it preserves my information just fine.
I suspect your boss (and maybe you) are using an antiquated browser, such as Netscape 4.x that does not preserve this information.
If that's the case, as far as I know there's nothing you can do to solve this...
If anyone else knows different, please respond, but I don't see how that could be the case since this is all client-side.
:(
mizroo
03-14-2003, 04:38 AM
Sorry, I think I didn't present the information correctly. :p But clicking the back button, the selection at th combo box is still at the selection made previously and then now, if you hit the submit button, the form will by pass validation and submit. *aRgHS* -scratch head-
We are using Netscape 6.0 and IE 5 by the way. ;)
Thank you so much whammy! and sorry for the late reply. My company has blocked out forums and I can only access forums at certain times. :(
david7777
03-14-2003, 08:37 AM
You can try make a small client side javascript to force the catagory drop down menu to go to the first item in the list.
ie:
<script>
document.bookings.category.value = ""
document.bookings.category.selectedIndex= 1 // Or 0, i cant remember which it begins with
</script>
i might not be understanding this correctly, but i think it comes down to this: you want to prevent the client from jumping back to the form and submit it again (to prevent duplicate entrys or incomplete entrys)?
if so. These are some tricks i use:
- Response.Expires -1000 'the page is expired immediately and isn't cached browsersided. User can not go back.
- set a flag --> use a session-variable and set it to "saved" after you processed the form for the first time. The user will see the (incomplete) form when be hits the backbutton or uses "shift <--", since it is cached browsresided, but when he submits the form, the asp-page that processes the form checks for the session-variable. If the session-variabels value is "saved", you can show an erromessages, redirect to an empty form etc etc. If the session-variables value is empty, then the form is processed and the info is sent to the db.(and then the flag is set (see top of paragraph)
In this approach you need to clear the session-variable at some point (unless the form can onlybe saved once for each session).
- after inserting/updating the info, automatically redirect to the formpage which will be shown as an empty form.
- build a "state-engine"
If the user can't go back, the wrong/incomplete/duplicate info can't be submitted. If he can go back, you can only prevent that the form is processed again.
If it's important, then I woudn't use javascript since it can be disabled browsersided.
I don't quite understand what you mean with 'the validation is bypassed'. Is this a broser-sided validation (-->don't use that!)
I might be completely off here. Rereading your post, i think you want to prevent the client from jumping back 1 page, and you wan't to force him to jump back two pages ? Correct ? If so, i woun't use multipurpose pages are javascript to generate refreshed pages browsersided. I'd go for a "one step per page" approach (with or without some kind a dynamical menu) were each page connects to the server and get's processed. Then the user can easialy navigate through the pages.
You could then control the pageflow more easiely with some kind of "state-engine". = A sort of tracking system (values in a session-variable array) that record the state of the form(s) and the actions than are allowed in the present state and data that's needed for it. (your state-logic could prevent users from junping from page 4 to page 3 and automaticaly redirect to page 2 and refill the form's data) If you want maximm userflexability, and have multipage fill-in procedures, then you'll have to start thinking of setting up some sort a state-engine. But be aware ! Don't rely to hard on the session-object ! It can do funny stuff want you use frames (if your first framepage is an html page) and can slow down your app if you have a lot of users.
"Maintaining state" is one of the hardest things in you want to skip browser and serversided + if you want to allow that the user jumps back and forward through the pages.
Look at some big-firm application. You'll be pulling our hair out (to much different pages, to much server-connections, to much 'page is expired' messages when you navigate through the browser-history) be they are stable and keep there db's clean.
scroots
03-16-2003, 08:32 PM
document.referer or something so you can check where they came from and then use histroy.forward
scroots
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.