Jump to content

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

Umm... all you have to do with a reset button is place it in your form:
[code]
<input type="reset" name="reset" value="Reset" />
[/code]

It will automatically clear all your fields when you click on it. I'm not sure I follow what you're after.
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]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.