Jump to content

Use reset button in form


lucerias

Recommended Posts

How to use the following button, which is a reset button to reset all the text of list field in a particular form back to default value? Thank you.

<td width="30%"><input title="RESET_BUTTON" accessKey="{APP.LBL_CLEAR_BUTTON_KEY}" class="button" onclick="this.form.action.value='clear'" type="submit" name="button" value="  RESET " ></td> 
Link to comment
https://forums.phpfreaks.com/topic/25807-use-reset-button-in-form/
Share on other sites

It don't really clear the form, it resets the form to the value specified by the value attribute. So if value is "something" then it will be changed back to "something" if the reset button is clicked, but if you do not use the value attribute then this is not a problem.
[quote author=ToonMariner link=topic=113465.msg461476#msg461476 date=1162429084]
WHY?

<input type="reset" name="reset" value="Reset" />

That does it all for you - only use js when your really have to and if you just want the defaults then you don't need it.

[/quote]

One reason I could think of is simply to use a link instead of a button.

To answer the question posed above, just call the javascript function like you would for submit() on a form:
[code]
<a href="#" onclick="document.formName.reset();">reset</a>
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.