View Full Version : Clear Form Button
redice
08-28-2005, 08:51 AM
HI,
How does one make a button or link for a form so that it clears
text entered in a form?
Redice
<input type="reset"/>
Make sure it's inside the desired <form>.
redice
08-28-2005, 10:36 AM
thanks twey
how bout when wanting to apply it to an image?
Maybe I could upload the page for you to have a look, and also let me know how I could apply a mail form script to my form! Is that OK?
Redice
<form id="form1">
<input type="text"/>
<input type="text"/>
<input type="password"/>
<input type="text"/>
</form>
<img src="image.jpg" onclick="document.getElementById('form1').reset();"/>
redice
08-28-2005, 12:11 PM
the code works well. thnx
but when i put the cursor over the image in the browser
the cursor doesnt change. Isnt it ment to?
redice
No. If you want it to, you can use:
<img src="image.jpg" onclick="document.getElementById('form1').reset();" style="cursor:pointer"/>
redice
08-28-2005, 05:34 PM
how do i make text and image as submit button? For the form?
You can add onclick="document.getElementById('form1').reset();" to any element: <span>, <img>, <p>, <a>...
redice
09-13-2005, 08:20 PM
Hi all,
Back at this!! I got the clear to work fine.
how do i get the submit/send button to work?
Exactly the same as reset, but you use submit() instead of reset().
redice
09-14-2005, 04:13 PM
still not successful :( i must e doin sumthin wrong :confused:
Could someone kindly check the code and see where m going wrong
-----------------------------------------
================================
[CODE]
<form id="form1" method="post" action="/cgi-sys/formmail.pl">
<td width="162" valign="top">
<p>
<div style="margin-left:17px; margin-top:12px; font-family:verdana; font-size:9px ">Name</div>
<div style="margin-left:17px; margin-top:2px; font-family:verdana; font-size:9px "><input type=text name="realname"></div>
<div style="margin-left:17px; margin-top:2px; font-family:verdana; font-size:9px ">Email</div>
<div style="margin-left:17px; margin-top:2px; font-family:verdana; font-size:9px "><input type=text name="email"></div>
<div style="margin-left:17px; margin-top:2px; font-family:verdana; font-size:9px "><input type=hidden name="env_report" value=""></div>
<div style="margin-left:17px; margin-top:2px; font-family:verdana; font-size:9px ">Subject</div>
<div style="margin-left:17px; margin-top:2px; font-family:verdana; font-size:9px "><input type="text" name="field_1_value"></div>
<div style="margin-left:17px; margin-top:2px; font-family:verdana; font-size:9px "></div>
<div style="margin-left:17px; margin-top:2px; font-family:verdana; font-size:9px "><input type="hidden" name="field_2_description" value="Domain name">Message</div>
<div style="margin-left:17px; margin-top:2px; font-family:verdana; font-size:9px "><textarea name="field_3_value"style="width:145px; height:80px; font-family:tahoma; font-size:11px; overflow:auto " type="text" value=""></textarea>
<br><input type="hidden" name="field_3_description" value="Message"></div>
<div style="margin-left:17px; margin-top:12px; font-family:verdana; font-size:9px ">
<div style="margin-top:3px; margin-right:12px " align="right"><span class="style1""onClick="document.getElementById('form1').reset();"style="cursor:pointer">clear</span><img src="images/arrow1.jpg" border="0" align="absmiddle" style="margin-left:5px; margin-right:8px "><strong><span class="style1""onClick="document.getElementById('form1').submit();"style="cursor:pointer">send</strong></a><img src="images/arrow1.jpg" border="0" align="absmiddle" style="margin-left:5px "></a></div>
<br>
<input type="hidden" name="recipient" value="info@domain.net">
<input type="hidden" name="subject" value="">
<input type=hidden name="title" value="Message sent">
<input type=hidden name="return_link_url" value="http://www.domain.net/contcact us.html">
<input type=hidden name="return_link_title" value="Back">
<input type=hidden name="background" value="">
<input type=hidden name="required" value="field_1_value,field_3_value"><input type=hidden name="sort" value="order:field_1_description,field_1_value,field_2_description,field_2_value,field_3_description,field_3_value">
</p>
</form>
[CODE]
---------------------
=================
I want to apply the submit code to the submit text.
Redice
Wizard13335
09-15-2005, 12:24 AM
What i did to submit was just
<input type="submit" name="submitbutton(or whatever)"> For a button, and for a link i did:
<a href="#" onclick="name_of_form.submit()" name="submitlink(or whatever)">
hope that helps, although it is pretty simple code :o
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.