Classic ASP, <SELECT> postback, Browser Navigation

Discussion in 'ASP General' started by Jai Singh, Jun 17, 2009.

  1. Jai Singh

    Jai Singh Guest

    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
     
    Jai Singh, Jun 17, 2009
    #1
    1. Advertising

  2. Jai Singh

    Bob Barrows Guest

    Jai Singh wrote:
    > 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.


    There is no such thing as a "<SELECT> combo" but that's just a nitpick.
    What you have is a SELECT element.

    > 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?
    >

    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
     
    Bob Barrows, Jun 17, 2009
    #2
    1. Advertising

  3. Gazing into my crystal ball I observed =?Utf-8?B?SmFpIFNpbmdo?=
    <> writing in
    news::

    > 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
    >


    ASP knows nothing of what is going on client side, and this is a client
    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
     
    Adrienne Boswell, Jun 17, 2009
    #3
  4. Jai Singh

    Jai Singh Guest

    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:
    > 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, Jun 17, 2009
    #4
  5. Jai Singh

    Evertjan. Guest

    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., Jun 17, 2009
    #5
  6. Jai Singh

    Jai Singh Guest

    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

    "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)
    >
     
    Jai Singh, Jun 18, 2009
    #6
  7. Jai Singh

    Evertjan. Guest

    Jai Singh wrote on 18 jun 2009 in
    microsoft.public.inetserver.asp.general:

    > "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?


    [Please do not toppost on usenet]
    [please do not quote signatures on usenet]

    > 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.


    You are so wrong, Jai,

    This is not just a public forum but usenet.

    Usenet NGs do not have such "sole purpose"s.

    > People would not be posting
    > here if they had all of the answers.


    You wrongly suspect I am asking you personally.
    I would have written you an email, if that were the case.

    My "Are you all ...?" shows I was replying to the NG in general,
    but I do not mind if you feel personally also spoken too by "copying and
    copying and copying and copying", though I doubt if you could be the
    source of 95,900 Google hits.

    And why should I have to be responding with something usefull?
    This is usenet, not a paid helpdesk.

    > 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.


    Good for you, but these lines are not modifying header lines, and not
    modifying in order to anything, they are just adding header lines.

    My question in another form:
    "What was your reason of picking this special date?"
    could be quite unuseful to you, but It seeems to be there could be a
    reason, which would interest me.

    > In Actuality I finally decided to use Response.AddHeader "Expires", 0.


    Fine with me.

    > If you have anything of educational value to contribute then please do
    > so.


    Again, this is usenet, the OP cannot and should not limit the responses,
    as you do not own the thread.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jun 18, 2009
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Laurahn
    Replies:
    3
    Views:
    910
    Steven Cheng[MSFT]
    Feb 6, 2007
  2. A Ratcliffe

    Confirming Postback in classic ASP

    A Ratcliffe, Jul 6, 2003, in forum: ASP General
    Replies:
    1
    Views:
    335
    Matthew Lock
    Jul 7, 2003
  3. Don Miller

    Classic ASP - Stream XML from SP to Browser

    Don Miller, Mar 5, 2009, in forum: ASP General
    Replies:
    3
    Views:
    772
    Don Miller
    Mar 5, 2009
  4. palmiere
    Replies:
    1
    Views:
    413
    Erwin Moller
    Feb 9, 2004
  5. fig000
    Replies:
    1
    Views:
    205
    Michael Winter
    Apr 8, 2004
Loading...

Share This Page