You should postpone your form submition and if history switch will happen - this postponed action will not happen.
Ex. <button onclick="window.history.fo
Main Topics
Browse All TopicsHello,
I am developing an application that requires navigation to previous and next pages to answer questions on those pages via a form (for example, like an install wizard). I have discovered that the history functions will allow me to do navigation. I would like to do the following:
If I am on a page that has history in front of it (i.e it is not the last page in history), I want to navigate to the next page in history (history.forward()). If I am on a page that does not have history in front of it (i.e. it is the last page in history) I want to submit to the next page via the current page's form action attribute.
Therefore I need to know "How can I tell whether the page I am currently on is the last page in history or not".
By knowing that I can implement the functionality by putting a "next" button on the current page with code somewhat like the following:
< cfIf (the current page is the last page in history)>
<cfinput name="submit" type="submit" value="Next"> <!--- the form's action attribute takes --->
<cf else> <!--- me to the next page --->
<cfinput name="mybutton" type="button" value="Next" onclick="history.forward()
</cfif>
So again my question: How can I tell whether the current page is the last page in history or not.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hello mfreeman2,
In the sample code you give, you're mixing 2 types of programming: server side (ColdFusion) and Client (browser) side (Javascript).
From a server side perspective, I would simply suggest to create a variable containing the highest page count displayed ("MaxViewedPage" for instance). You could store this variable into a cookie (and if your user don't accept cookies, it will still be able to go through your form, just not navigate). I assume you'll will find how to do it within ColdFusion. However, if not (or not working), you can still do it through javascript (see http://techpatterns.com/do
Would read something like (beware, I don't speak "ColdFusion" language, just guessing):
< cfIf (#Variables.CurrentPage# > #Variables.MaxViewedPage#)
<!-- set a cookie, with name MaxViewedPage, and value of CF variable #CurrentPage#. -->
<cfinput name="submit" type="submit" value="Next">
<cf else>
<cfinput name="mybutton" type="button" value="Next" onclick="history.forward()
</cfif>
Business Accounts
Answer for Membership
by: BadotzPosted on 2007-01-11 at 22:15:57ID: 18299330
um, by counting? You should know the first and last page numbers, and the number of the page you're on as well?