Classic ASP, <SELECT> postback, Browser Navigation

J

Jai Singh

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
 
B

Bob Barrows

Jai said:
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?
What is the intended behavior? What do you want the user to see when he
navigates back to a page in history?
 
A

Adrienne Boswell

Gazing into my crystal ball I observed =?Utf-8?B?SmFpIFNpbmdo?=
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).
 
J

Jai Singh

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
 
E

Evertjan.

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

Jai Singh

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
 
E

Evertjan.

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

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top