SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2007
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Clearing form after submit

    Hey guys.

    I've got a form that submits to an iframe. This means the page does not reload, so whatever is submitted by the form, stays in the form. I think this poses a security threat so I was just wondering if there was anything I can do so that when the submit button is pressed, the form is cleared?

    Thanks in advance for any replies.

  2. #2
    SitePoint Enthusiast
    Join Date
    May 2007
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No takers?

  3. #3
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    document.forms[index].reset();

  4. #4
    SitePoint Enthusiast
    Join Date
    May 2007
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So something like:

    Code:
    <input type="submit" name="sub1" value="Submit" onClick("document.forms[index].reset();">

  5. #5
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <input type="submit" name="sub1" value="Submit" onClick="document.forms[yourFormIndex].reset();">
    If you have more then one form in your page you can access it with 'forms[index]'. i.e. forms[0] is your first form, forms[1] second....


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
  •