lucerias Posted November 1, 2006 Share Posted November 1, 2006 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> Quote Link to comment https://forums.phpfreaks.com/topic/25807-use-reset-button-in-form/ Share on other sites More sharing options...
obsidian Posted November 1, 2006 Share Posted November 1, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/25807-use-reset-button-in-form/#findComment-117850 Share on other sites More sharing options...
Daniel0 Posted November 1, 2006 Share Posted November 1, 2006 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 Link to comment https://forums.phpfreaks.com/topic/25807-use-reset-button-in-form/#findComment-117948 Share on other sites More sharing options...
fenway Posted November 1, 2006 Share Posted November 1, 2006 Or you can use the .reset() method. Quote Link to comment https://forums.phpfreaks.com/topic/25807-use-reset-button-in-form/#findComment-118088 Share on other sites More sharing options...
lucerias Posted November 2, 2006 Author Share Posted November 2, 2006 Then can i code on the onclick action to specify which field set to what value? If that is the case, may i know how to code for the onclick action? Quote Link to comment https://forums.phpfreaks.com/topic/25807-use-reset-button-in-form/#findComment-118202 Share on other sites More sharing options...
ToonMariner Posted November 2, 2006 Share Posted November 2, 2006 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 Link to comment https://forums.phpfreaks.com/topic/25807-use-reset-button-in-form/#findComment-118206 Share on other sites More sharing options...
obsidian Posted November 2, 2006 Share Posted November 2, 2006 [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] Quote Link to comment https://forums.phpfreaks.com/topic/25807-use-reset-button-in-form/#findComment-118391 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.