Here is what I had to do:

<script language="JavaScript1.1" type="text/javascript">

 function clearForm(){
       document.forms["personForm"].elements["person.id"].value = "";
       document.forms["personForm"].elements["person.first_name"].value =
"";
       document.forms["personForm"].elements["person.last_name"].value = "";
       document.forms["personForm"].elements["person.middle_name"].value =
"";

       document.personForm.elements["btnAddresses"].disabled = true;
       document.personForm.elements["btnMobilePhones"].disabled = true;
       document.personForm.elements["btnInsert"].disabled = false;
       document.personForm.elements["btnUpdate"].disabled = true;
       document.personForm.elements["btnDelete"].disabled = true;
  }

</script>

... and for the reset button you do something like this:

<html:button property="btnReset" value="Clear All" onclick="clearForm()"/>

enjoy...

-----Original Message-----
From: Kwang-Shi Shu [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 12:33 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: How to make reset button clear all fields


 I noticed the following behavior for "RESET" button in "STRUTS" framework:

        The Reset button will clear all fields on the first try. After that, if
you encountered validation errors, it seems to remember what have been
        so far. From that point on, the "reset" button only clears the new
        input values. Case in point -- try the "struts-example" login.jsp and
        you know what I am talking about.

  What should I do if I still want to clear all field contents. I tried to
use
        another button declared as "<input type="reset">" and it is not working
        either.

Shu, Kwang-shi          | Tel 732-460-7848
Village Networks, Inc.  | Fax 732-460-9851
246 Industrial Way West |
Eatontown, NJ 078724    | email: [EMAIL PROTECTED]




Reply via email to