Jump to content

Archived

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

essjay_d12

Clear Form Button

Recommended Posts

use asreset button like so:
[code]<input type="reset" value="Reset Form Fields">[/code]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

×

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.