essjay_d12 Posted March 29, 2006 Share Posted March 29, 2006 How do I go about creating a button that clears values in form fields?Tad Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted March 29, 2006 Share Posted March 29, 2006 use asreset button like so:[code]<input type="reset" value="Reset Form Fields">[/code] Quote Link to comment Share on other sites More sharing options...
essjay_d12 Posted March 29, 2006 Author Share Posted March 29, 2006 is it possible to exclude certain input boxes ?for example one is a readonly input box and i do not want that cleared.ta d Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted March 30, 2006 Share Posted March 30, 2006 You might want to use javascript to clear the fields you want clearing instead. Like this:[code]<script type="text/javascript">function clearForm(){ document.formName.name.value = ""; document.formName.email.value = "";}</script><form name="formName" action="fileName.php" method="get">Name: <input type="text" name="name"><br />Email: <input type="text" name="email"><br />Special Field: <input type="text" name="special" value="doesn't get cleared" /><br /><input type="button" value="Reset" onClick="clearForm()"></form>[/code] To add more follow this template:[code]document.[name of form here].[name of input field].value = "";[/code] Quote Link to comment 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.