|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Classic ASP, <SELECT> postback, Browser Navigationworking on a data entry page in Classic ASP that preservers state through the Session object. I have on HTML FORM <SELECT> combo that provides a list of countries. I have wired this up to cause a postback via "<select name=""txtCountryID"" size=""1"" onchange=""mainform.submit()"">". In the asp page I respond to this post back and I change the input type of another data entry field based upon the current value of the txtCountryID <SELECT> control. Meaning, another control is switched to either an <INPUT type="text" or an <SELECT> itself. For example, if the Country is US then the state data entry field is a list of predefined states via a select combo, but if Country is CN then the state data entry field is a blank text input. The problem that I notice is that a user can use the Browsers navigation buttons to move back to a pre-existing page. In some situations the following occurs... User chooses country US and selects a state from the state select list of CA and then changes the country to CN and the state field changes, correctly, to an input text that is empty. User navs to prior page via browser. Page now displays the Country of CN with the state <SELECT> that has a value of CA! I detect no post-back in my page when the browser navigation occurs. What is the proper way to create the user interaction and deal with this problem? Thanks in advance, Jai Singh Jai Singh wrote:
> I am new to Classic ASP development and web development in general. There is no such thing as a "<SELECT> combo" but that's just a nitpick.> I am working on a data entry page in Classic ASP that preservers > state through the Session object. > > I have on HTML FORM <SELECT> combo that provides a list of countries. What you have is a SELECT element. Show quoteHide quote > I have wired this up to cause a postback via "<select What is the intended behavior? What do you want the user to see when he> name=""txtCountryID"" size=""1"" onchange=""mainform.submit()"">". > > In the asp page I respond to this post back and I change the input > type of another data entry field based upon the current value of the > txtCountryID <SELECT> control. > Meaning, another control is switched to either an <INPUT type="text" > or an <SELECT> itself. > > For example, if the Country is US then the state data entry field is > a list of predefined states via a select combo, but if Country is CN > then the state data entry field is a blank text input. > > The problem that I notice is that a user can use the Browsers > navigation buttons to move back to a pre-existing page. In some > situations the following occurs... > > User chooses country US and selects a state from the state select > list of CA and then changes the country to CN and the state field > changes, correctly, to an input text that is empty. > > User navs to prior page via browser. > > Page now displays the Country of CN with the state <SELECT> that has > a value of CA! > > I detect no post-back in my page when the browser navigation occurs. > > What is the proper way to create the user interaction and deal with > this problem? > navigates back to a page in history? -- HTH, Bob Barrows Bob,
Well, if at all possible, I certainly would like to avoid a cached situation in which the HTML form is displayed with mis-matched controls (i.e. Country is CN but has a <select> drop down of US states). I did a little google-research and discovered some serverside scripting techinques for controlling clientside caching. By adding the following to the beginning of the .asp page.... Response.CacheControl = "no-cache" Response.AddHeader "Pragma", "no-cache" Response.AddHeader "Cache-Control", "no-cache" Response.AddHeader "Cache-Control", "private" Response.AddHeader "Cache-Control", "no-store" Response.AddHeader "Cache-Control", "must-revalidate" Response.AddHeader "Cache-Control", "max-stale=0" Response.AddHeader "Cache-Control", "post-check=0" Response.AddHeader "Cache-Control", "pre-check=0" Response.AddHeader "Keep-Alive", "timeout=3, max=993" Response.AddHeader "Expires", "Mon, 26 Jul 1997 05:00:00 GMT" Response.Expires = -1 Response.Buffer = True ..the HTTP header is modified to, hopefully, prevent the client side cache of the .asp page and thus force a postback when the Browswer's Navigation button is utilized. Jai Singh Bob Barrows" wrote: Show quoteHide quote > What is the intended behavior? What do you want the user to see when he > navigates back to a page in history? > -- > HTH, > Bob Barrows Jai Singh wrote on 17 jun 2009 in microsoft.public.inetserver.asp.general:
> Response.AddHeader "Expires", "Mon, 26 Jul 1997 05:00:00 GMT" What's so special about this date"Mon, 26 Jul 1997 05:00:00 GMT" That it gives 95,900 Google hits? Or are you all copying and copying and copying and copying code you do not understand? -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress) Evertjan,
If you are going to bother to post in a public forum whose sole purpose is to allow developers to learn about topics and review code samples... then please make it useful. People would not be posting here if they had all of the answers. When I posted previously I gave samples of techniques that I had learned about via public forums and some of those code lines were duplicates of one other. But, essentially, it is my understanding that they are modifying the HTTP Header in order to notify the browser (be it IE, Safari, etc.) that it should not cache the .asp page in utilization. In Actuality I finally decided to use Response.AddHeader "Expires", 0. If you have anything of educational value to contribute then please do so. Jai Singh Show quoteHide quote "Evertjan." wrote: > Jai Singh wrote on 17 jun 2009 in microsoft.public.inetserver.asp.general: > > > Response.AddHeader "Expires", "Mon, 26 Jul 1997 05:00:00 GMT" > > What's so special about this date > > "Mon, 26 Jul 1997 05:00:00 GMT" > > That it gives 95,900 Google hits? > > Or are you all copying and copying and copying and copying > code you do not understand? > > -- > Evertjan. > The Netherlands. > (Please change the x'es to dots in my emailaddress) > Gazing into my crystal ball I observed =?Utf-8?B?SmFpIFNpbmdo?=
<JaiSi***@discussions.microsoft.com> writing in Show quoteHide quote news:6D1F3551-86A2-4D4D-83E7-BF84BD0A8C56@microsoft.com: ASP knows nothing of what is going on client side, and this is a client > I am new to Classic ASP development and web development in general. I > am working on a data entry page in Classic ASP that preservers state > through the Session object. > > I have on HTML FORM <SELECT> combo that provides a list of countries. > I have wired this up to cause a postback via "<select > name=""txtCountryID"" size=""1"" onchange=""mainform.submit()"">". > > In the asp page I respond to this post back and I change the input > type of another data entry field based upon the current value of the > txtCountryID ><SELECT> control. > Meaning, another control is switched to either an <INPUT type="text" > or an ><SELECT> itself. > > For example, if the Country is US then the state data entry field is a > list of predefined states via a select combo, but if Country is CN > then the state data entry field is a blank text input. > > The problem that I notice is that a user can use the Browsers > navigation buttons to move back to a pre-existing page. In some > situations the following occurs... > > User chooses country US and selects a state from the state select list > of CA and then changes the country to CN and the state field changes, > correctly, to an input text that is empty. > > User navs to prior page via browser. > > Page now displays the Country of CN with the state <SELECT> that has a > value of CA! > > I detect no post-back in my page when the browser navigation occurs. > > What is the proper way to create the user interaction and deal with > this problem? > > Thanks in advance, > Jai Singh > side issue. You would be better off posting to a client side group, perhaps alt.html or comp.lang.javascript (if you are going to post to more than one group, please Cross post, don't multipost). -- Adrienne Boswell at Home Arbpen Web Site Design Services http://www.cavalcade-of-coding.info Please respond to the group so others can share
Other interesting topics
How can I type in the combo box <select> ?
How to change all relative paths in a website??? What is the real IP address of the site visitor? ASP 0126 Select INTO, UNION Pinpoint unspecified error for objXMLHttp.send objXML statement Microsoft OLE DB Provider for ODBC Drivers error '80004005' Problem with Instr to find a space ClientScript working in IE but not in Mozilla technology choice |
|||||||||||||||||||||||