Re: using hyperlinks as submit buttons
- From: "Andy Dingley <dingbat@xxxxxxxxxxxxxx>" <dingbat@xxxxxxxxxxxxxx>
- Date: 27 Jun 2006 08:30:08 -0700
Alexander Weiner wrote:
It is absolutely necessary, that all the parameters are send by post and not
by get.
Then you _must_ submit from a <form>, not an <a> link (OK, so you
could do some AJAX-like thing too)
You have three options: CSS, JavaScript or a lot of JavaScript.
For CSS you make a bog-standard <form> with a submit button on it, then
you use CSS to make it look as much like an <a> as possible. This is
the simplest and most robust.
For JavaScript then you code a HTML <a> as normal, code a <form> as
well, then you use JavaScript to trap the <a onclick=... > event and
use it to do a form submit instead. jojo had the right idea, but coded
it unworkably badly. Return false afterwards, or else the <a> will
still try and navigate somewhere. What to set the <a href=... >
attribute to depends on what you wnat to happen for non-JS users. If
you want them to be disabled safely, then use href="#". If you permit
them to submit via a GET, but at least have something still working,
then set this link in the href as normal. Returning false will guard
against double submissions.
With a whole bunch of JavaScript and AJAX, you can do it without the
extra HTML coding.
.
- Follow-Ups:
- Re: using hyperlinks as submit buttons
- From: Alan J. Flavell
- Re: using hyperlinks as submit buttons
- From: jojo
- Re: using hyperlinks as submit buttons
- References:
- using hyperlinks as submit buttons
- From: Alexander Weiner
- using hyperlinks as submit buttons
- Prev by Date: Re: Odd dashes on my home page.
- Next by Date: Re: Source code to display "as is" (help!!)
- Previous by thread: Re: using hyperlinks as submit buttons
- Next by thread: Re: using hyperlinks as submit buttons
- Index(es):