HTML Forms
Hey everyone - Is there anyway to have buttons on forms just be text links? The shopping cart software I am using really wants me to use images, but I really don't want to. The closest I can come to using text is to do it as buttons, but for stylistic reasons, I just want text....
Anyone know how to do it?
Thanks in advance!
Anyone know how to do it?
Thanks in advance!
Comments
Attach a javascript event to the link that fires form.submit().
Depending on your purposes you may also need to set a hidden form field that describes what link was clicked (for example, cancel or ok).
The form would need to be accessible using the id 'form' or similar, and depending on the end-user's web browser you might need to adapt the script to work.
Hm.
Maybe there's an easier way.
<form name="yourform" action="somepage.html" method="post">
input boxes here
<a href="#" onClick="JavaScript:this.form.submit();">Your Text Link Here</a>
</form>
Give that a try
Edit: The forums are putting a space in between Java and Script. It should be one word: JavaScript
This is how my code is now, using an image as the link:
<form action="http://www.cartserver.com/sc/cart.cgi" method="post">
<div>
<input type="image" name="add" src="../images/buy.jpg" alt="Buy" />
<input type="hidden" name="item2" value="b-1234^AUG-090400^Auger Bit - 9.25" Length, .4" Diameter^8.99^1^^^^.24^" />
</div>
</form>
But when I do this, it doesn't work:
<form name="add" action="http://www.cartserver.com/sc/cart.cgi" method="post">
<input type="hidden" name="item2" value="b-1234^AUG-090400^Auger Bit - 9.25" Length, .4" Diameter^8.99^1^^^^.24^" />
<a href="#" onClick="javaScript:this.form.submit();">Buy</a>
</form>
Any ideas?
[Edit: java script is one word in my code, so i didn't overlook that...]