Submitting a form by link click
Question: Can I submit a form by clicking a link?
Here is an example: click on any of the hyperlinks (Link 1, Link 2, or Link 3),
and a form on this page will be submitted with value
The hyperlinks with
<a href="#" onclick="document.forms.v.value='Link1'; document.forms.submit();">Link 1</a> <a href="#" onclick="document.forms.v.value='Link2'; document.forms.submit();">Link 2</a> <a href="#" onclick="document.forms.v.value='Link3'; document.forms.submit();">Link 3</a> <form name=f1 action="" method=GET target=_blank > <input name=v type=hidden value=undefined> </form>Note that this example is a very unusual scenario. Typically, the users expect that
(A) clicking a link causes the browser to navigate to the link's destination URL;
(B) a form submission causes the browser to display the results produced by a server-side application located at the form's
Combining both actions (A) and (B) in a single click might confuse the user.
Therefore, submitting a form by a link click is a usability problem and should be avoided.
(In the above example, the form's action URL with the query string