• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how do I get around "onLoad" in my app

 
kay lin
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All:
I have an app, that would display a date field. if a page is first load up, it would display today's date as default, this is achieved by using the onLoad tag and set it like the following:




The user can choose to enter any date they wish as well, but the problem comes when the user goes to the next page, and hit the "back" button on their browser, now they are suppose to see whatever they have entered in the date field, but because of this


thing, every time, the user hit the "back" button, the default date will be displayed, which is not Desirable.

So my question is , how can i get the page to display the default DATE only ONCE when it first loads up, and when a user hits the "back" button on the browser, he will see whatever he has entered.


if anyone could possibly help me with it, i'd TRULY appreciate it.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check to see if the date field contains any information before filling it in

if(document.FormName.ElementName.value.length==0)document.FormName.ElementName.value = new Date();

or
You can use session cookies...

Eric
 
kay lin
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Eric Pascarello:
Check to see if the date field contains any information before filling it in

if(document.FormName.ElementName.value.length==0)document.FormName.ElementName.value = new Date();

or
You can use session cookies...

Eric


How do I use a session cookies to do this? could you give me a hint/example? many thanks
 
Eric Pascarello
author
Rancher
Posts: 15385
6
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic