Wrox Programmer Forums
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 23rd, 2004, 09:03 AM
Registered User
 
Join Date: Jul 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Back Button Losing form Values

Here's an odd one that I've been battling with and have so far refused to cheat!

I have a form that can recieve manual data or data grabbed from another popup page.

The first form (I'll call it The Call Form) has a search facility - so the user, if they have one, can put in an account number - click search and up pops a list of properties associated with that account number. The user then clicks on the appropriate one and the details are sent back to the Call Form where they populate the relevant controls.

When the Call form is filled in manually (not using the search form) and submitted, thus moving to the next page, if the user then clicks the browser back button all the controls on the Call Form are re-populated (as you would expect as the history object retains the form control values) But But But......

If I use the search facility to populate the Call Form controls, submit the form and then click the browser back button - the Call Form controls are empty - the values have been lost, the user gets angry and go home early!

I have trawled the web but cannot find an answer.

Any help would be most appreciated.

Thank you in advance.




PF
 
Old July 29th, 2004, 07:43 AM
Authorized User
 
Join Date: Dec 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

 In the latter case where u populate call form with the search form,
 the data value are transferred from source to destination and in case
 if the user clicks the back button after submitting, the form searches for
  the pop up form values and hence blank values are sustained.

As per my knowledge,
   the better alternative is, once he submits the form,
   make the back button disabled like by giving the javascript
   syntax as follows

        history.forward()

Hope this works in avoiding the user to navigate back to the call form.

cheers


Mn Karthik
 
Old July 29th, 2004, 05:46 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Interesting

If you figure out how to 'disable the back button' on the IE toolbar - please post the method. I have gone down this path before without success.

I am aware how to diable the right click then back or create a JS controlled popup window where you can remove the back button (along with all the other tools,status,address etc..) but did not know you could 'disable it'

Intrigued

BTW:
paulfram
A way you could resolve your issue would be to use hidden form variables
OR
When a value is entered into an input field pass it into a 'temporary' session variable then on your 'call form' for each input form tag
if session("name") <> "" then write value. This way it doesn’t matter how back/forward button happy your users are, the values are available. But remember use session vars sparingly

HTH



Wind is your friend
Matt
 
Old July 30th, 2004, 04:00 AM
Registered User
 
Join Date: Jul 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks chaps.

I like the history.forward() idea - I shall have a play with that today and let you know results - I now understand why the values are (apparantly) being lost. Thanks Mn Karthik.

Matt. Good thinking, this is what I referred to as ("so far I've refused to cheat")!! I too, like you, would love to find the nirvana of disabling the back button - it kind of takes over your life - if it's any consolation I have seen many top flight booking web sites (probably costing their companies hundreds of thousands to deploy) that have a little note saying "Please do not use the back button..."!!!!

I have found with the JS popup window solution you can remove the toolbar (& back button etc) but I can only hide it - press F11 in ie and back it comes.......

So anyone find a complete removal of all things dangerous then please keep me informed.

Thank you both once again for your interest.

PF
 
Old July 30th, 2004, 04:27 AM
Registered User
 
Join Date: Jul 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry - having looked into the history.forward() it's not what I'm looking for.

I do not want to disable the user from going back to the call form (form 1 of 2) I want them to be able to say - oh hey I got the persons name wrong...let me just pop back and change it without having to enter all the values again.

Thanks anyway.

PF
 
Old July 30th, 2004, 09:20 AM
Authorized User
 
Join Date: Dec 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,
   "Read the below paragraph if u post the data to the destination form."

   One way of solving that problem is implementing a back button programatically in the submit form {that you will get after submitting the source(data))

  When u post the data all the values will be posted to the destination form.
  on clicking the back button on that form repost all the datas to the Source,
  from where the data got actually posted.

  Write an ASP script that does the job of filling the data in to the
  corresponding controls of the Source form.

  This provides the user not to click the back button, but instead he clicks the
  Back button that Programmer(you) has implemented in the form(submit).

  Just take care to fill those datas, if the controls are combo or list.

  Ex:

    <%

      if request("repost") then
      Response.Write "document.frmSample.txtName.value=" & request("txtNamePosted")
      ......
      end if

 May this will solve.Take care of syntaxial error.

Cheers

Mn Karthik
 
Old July 30th, 2004, 10:24 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Would it be correct in saying 'the average user doesnt know about pressing F11'

Wind is your friend
Matt
 
Old July 31st, 2004, 07:12 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Matt,

I too tried disabling Back button of IE without success, but had a work around for that. Say from Page1 user comes to page2, and if one wants to restrict the user from going back to page1, then within Page1, on the <Body onload event, write "history.go(1)", which would not let the user come back to page1 from page2.

If I find something useful on disabling that button, let me post here.

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old August 3rd, 2004, 02:24 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

happygv

mmmm - yes very good, I like that - 'simply' effective!.

Matt

Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
passing Multidimensional Array Values back to form stitch Classic ASP Databases 2 June 21st, 2013 01:59 PM
Variables losing their values jrensink78 ASP.NET 1.0 and 1.1 Basics 3 April 13th, 2006 01:09 PM
losing the leading zero in binary values giles BOOK: Beginning Java 2, JDK 5 Edition 2 September 22nd, 2005 11:41 AM
history.back or hitting the back button won't work lian_a Classic ASP Basics 4 July 29th, 2004 12:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.