View Full Version : Submit form by javascript (link)

04-29-2004, 01:09 PM
i have a problem with my code.
this is my code:
function Check(MemberItemCode,MemberCode,Store){
document.Formi.method = "POST";
document.Formi.action = "ViewItemMemberNew.asp?MemberItemCode="+MemberItemCode+"&MemberCode="+MemberCode+"&Store="+Store;

<form method="post" name="Formi">
<a href="void(0)" onClick="javascript:Check('154','999999','f0005');">company</a>

thanks ofir.

04-29-2004, 02:37 PM
Could you give us a clue as to what the problem is? Other than missing a double quote at the end of this line:
document.Formi.action = "ViewItemMemberNew.asp?

We can't help unless you give us some more details.

04-30-2004, 05:00 PM

It looks to me like what you're trying to do is have this link:

<a href="void(0)" onClick="javascript:Check'154','999999','f0005');">company</a>

dynamically add the values your sending from the onClick. What I don't get is why you're doing it through a function? Unless you're going to be having multiple links on the same page, the function is useless.

If this is the only link on the page, just hard code the link with the values you want sent to the next page, like this:

<A HREF="ViewItemMemberNew.asp?MemberItemCode=154&MemberCode=999999&Store=f0005">

And then from the asp page you can do a Request for the different parts of the url variables and do with them what you will.

I'm having a hard time understanding what the "void(0)" part in the link tag is for? But hope this helps in anyway.


05-03-2004, 09:52 AM
Thanks for the answer,
i have a page with a lot of links. and i want to do one function for all of them.
the problem is that i dont want pepole to see the url link on the address bar so i try to do this with a link that send it like a submit.
i need a function that take parameters from a link and send it to a new page like a submit on a form without to see the parameters on the address bar.
hope that i gave more details now.

05-03-2004, 10:20 AM
<script type="text/javascript">
function Check(MemberItemCode,MemberCode,Store){
var f = document.Formi;
return false;
<form method="post" name="Formi" action="ViewItemMemberNew.asp">
<input type="hidden" name="MemberItemCode" />
<input type="hidden" name="MemberCode" />
<input type="hidden" name="Store" />
<a href="#" onclick="return Check('154','999999','f0005');">company</a>
<a href="#" onclick="return Check('155','888888','f0006');">company 2</a>