SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    May 2002
    Location
    RI-USA
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Clear form on back

    Hi,
    I was wondering if its possible to clear a form after the form has been submitted. Like if a user hits the back button, I'd like the form to be blank. Is this possible?
    Thanks.

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Put this code in place of your body tag (this assumes your form is named 'form1'...change as needed)
    Code:
    <body onLoad="document.form1.reset();">
    This won't clear the form when the back button is pressed, but will clear it when the page loads. I don't know if it will actually work when the "back" button is pressed as I believe the pages is pulled out of cache but it's worth a try.

    Hope this helps.

    --Vinnie


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •