Results 1 to 2 of 2
  1. #1
    June Homer

    reset elements of a form with code

    I am attempting to reset the text boxes on a form. I cannot use the reset button as I want to make certain boxes visible and hide others prior to reset.

    The code for the form looks like this:-

    <form name="form1" method="post" action="/cgi-bin/database/pas.cgi">
    <table width="100%" border="0" cellspacing="0" cellpadding="5">
    <td width="22%" align="left" valign="middle"><font face="Arial, Helvetica, sans-serif" size="2" color="#000066">Arrival Date:</font></td>..........

    When I try document.form("form1").reset() or document.form(0).reset() I get an error message "Object does not support this property or method: document.form

    What am I doing wrong when referencing the form?

    Any help gratefully appreciated

    June Homer

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Silicon Valley, USA
    Thanked 94 Times in 90 Posts

    Re: reset elements of a form with code

    Forms are a collection, so try document.forms(1) or, if this is JavaScript, document.form1 (what you have in the NAME attribute).

    As a separate issue, won't the Reset method do the same thing as the reset button? Perhaps it would be better to run a script that blanks out the individual text fields you want to clear?

Posting Permissions

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