Knowledge Base

HOWTO: Submitting a Form From an Anchor (<A HREF=/?scid=...>).

Article ID: 166210

Article Last Modified on 11/17/2003


APPLIES TO


This article was previously published under Q166210

SUMMARY

This article describes how a form can be submitted to a server through the use of an anchor. It uses the little-known ability of JScript that allows you to run a script from an anchor without using events.

MORE INFORMATION

There are two simple steps to submitting a form from an anchor:
  1. Be sure the form has values for the NAME, ACTION, and METHOD properties. The NAME and ACTION properties are the only required ones, but it is a good idea to supply the METHOD also, for example:
          <FORM NAME=Form1 ACTION="http://myServerURL/MyPage.asp" METHOD=POST>
          </FORM>
    						
  2. Call a one-line script from an anchor. In the script, call the submit method of the form, for example:
    <A HREF="JAVASCRIPT:Form1.submit()"> Something </A>
    						
    NOTE: JavaScript is case-sensitive, so submit must be spelled all lowercase.

REFERENCES

For additional information on JScript and forms visit the MSDN Online Web Workshop:

Additional query words: jscript javascript script

Keywords: kbhowto KB166210