XML technologies / CSS / CSS Cookbook / Forms / Using simple HTML text links as submit buttons

(Excerpt from “CSS Kochbuch” by Christopher Schmitt)

Problem

You want to use a simple HTML text link to submit a form.

Solution

Use JavaScript behind the scenes to submit the form:

<form name="msgform" method="get" action="results.php">
  <label for="fmmsg">Message</label>
  <textarea name="fmmsg" accesskey="m" id="fmmsg" rows="5" cols="14"></textarea>
  <a href="javascript:document.msgform.submit( );">Submit</a>
</form>

Discussion

Whereas the recipe Submit buttons displayed as simple HTML text explained how to “disguise” a submit button as a simple HTML link, this recipe takes the opposite approach: using a simple text link as a submit button. The main drawback is that it does not work without JavaScript. Browsers that do not support JavaScript, or in which JavaScript is disabled, cannot use forms designed this way.

  

 

 

 

back to top