[thelist] Link to cause POST request
Paul Waring
paul at xk7.net
Fri Jul 29 08:15:43 CDT 2005
On Fri, Jul 29, 2005 at 05:48:41AM -0700, klute wrote:
> Is it possible to have a form whose submit is invoked
> by pressing on a link? I know I could <input
> type="image" name="submit"... and convert the link
> into image to achieve this result but was looking for
> a cleaner solution that does not involves images or
> submit buttons to generate a POST request. Perhaps
> this can be done with JavaScript?
You can do it with JavaScript like so:
<form name="myform" action="myscript.php" method="post">
<a href="#" onClick="document.myform.submit();">My Link</a>
</form>
When you click on the link, it should submit the form (basically
whenever you want to submit the form, use document.formname.submit();,
in case you want it to work for mouseover events or image clicks).
Paul
--
Rogue Tory
http://www.roguetory.org.uk
More information about the thelist
mailing list