Discussion Locked

Javascript, submit a form from a link...

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I would like to submit a form from a link.

I tried something like this...

a HREF="/asp/katalog.asp?action=save&page=3 target="_self" language="javascript"
onClick="document.form1.submit();">3

but it does not do it...

7 replies

by juanja

The only thing what you propose is going to do is go to the other page. What you need to do is include the values of the link as fields of the form, and then retrieve them before you check the stage of the process:

you replace this: action=save&page=3

for this:

3

to check the stage of the process get thesevariables at the beginning of the page:

action=request.form("action")
page=request.form("page")

if action="save" then........

Hope this helps,
bye

by fpc/ns

Depending on whether you need t osubmit a form via the GET method or the POST method there are different ways to do it.

To submit via a GET method you can simply write a query string into the link. Something like as follows:
Submit Form

Because unless otherwise specified all pages are loaded via the GET method this is simply sending the same data a form would have, but is done with a link/query string.

If the data must be sent via thePOST method the best way to do it is with hidden form elements and a simple javascript function. See the example below:

Submit Form

This discussion is closed to new replies.