HTML Forms

Posted:
in Genius Bar edited January 2014
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!

Comments

  • Reply 1 of 3
    nttntt Posts: 18member
    You can do this using javascript.



    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.
  • Reply 2 of 3
    willoughbywilloughby Posts: 1,457member
    Code:




    <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
  • Reply 3 of 3
    Hmmm. I can't seem to make that work.

    This is how my code is now, using an image as the link:

    Code:




    <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&quot; Length, .4&quot; Diameter^8.99^1^^^^.24^" />

    </div>

    </form>









    But when I do this, it doesn't work:

    Code:




    <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&quot; Length, .4&quot; 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...]
Sign In or Register to comment.