Results 1 to 5 of 5

Thread: Reset webform without using HTML reset button???

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    149

    Reset webform without using HTML reset button???

    On my webform I am currently using the HTML Reset button to reset the form. The problem is that when the form is viewed by someone to approve I would like to hide the button along with some other options to be available only on data entry.

    Is there another way i can reset the form, possibly in vbscript.

    I tried doing it in javascript but the validateRequiredFields that I have on the form fires stopping the reset.

    Anyone have any ideas?

    Thanks.

  2. #2
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Re: Reset webform without using HTML reset button???

    Where are you firing the JavaScript from? Can you turn of the CauseValidation for that Control?
    Magiaus

    If I helped give me some points.

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Reset webform without using HTML reset button???

    Use an asp:button whose causesvalidation property is false. In its codebehind, run through the control, setting textboxes to blank, comboboxes to first element, and so on.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    149

    Re: Reset webform without using HTML reset button???

    The javascript was in the onclick event for the asp button.

    I didn't even notice the CauseValidation property for the button, I will try it now with that set to false and I am sure it should work now.

    Thanks again guys.

    Magiaus, you always get my posts, thanks again. You should have my job.

  5. #5
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Re: Reset webform without using HTML reset button???

    To me reseting the form means making it contain the initial values it had when it was served to the client. Therefore - simply blanking out text boxes and selecting the first index of a combobox is not a reset - its a clear.

    Now, I don't know what your true intention was (reset or clear), but if it was the former then all you really need to suceed at it is:

    document.forms[0].reset();


    which resets all form values to their initial values as they were when the form was delivered to the client.

Posting Permissions

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



Click Here to Expand Forum to Full Width