On 6/8/07, Ambaris Mohanty <[EMAIL PROTECTED]> wrote:
Please someone send me the sample code for extending DynaValidatorForm and
implementing the reset method. I have no idea on how to do it. Please help.
I'm using struts 1.2.9.
Thank you,


HTML has the concept of a reset button:

  http://www.w3.org/TR/html401/interact/forms.html#reset-button

As stated in the link above, when a user activates a reset control,
the form values are set to their *inital values*.  This may not be the
reset behavior that you're looking for.

One way to implement a reset button that "clears" form element values
is with JavaScript.  You might do something like:

<button onclick="resetForm(); return false;">Reset</button>

<script type="text/javascript">
   function resetForm() {
       // acquire form reference, e.g.
       var myForm = document.forms['myForm'];

       // loop through elements
       for(var i = 0; i < myForm.elements.length; i++) {
              // check element type and implement reset
              //  your code goes here
       }
   }
</script>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to