Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Apr 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Submit form by javascript (link)

    Hi,
    i have a problem with my code.
    this is my code:
    <SCRIPT>
    function Check(MemberItemCode,MemberCode,Store){
    document.Formi.method = "POST";
    document.Formi.action = "ViewItemMemberNew.asp?MemberItemCode="+MemberItemCode+"&MemberCode="+MemberCode+"&Store="+Store ;
    document.Formi.submit();
    }
    </SCRIPT>


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

    thanks ofir.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #3
    New Coder
    Join Date
    Apr 2004
    Location
    The Ghetto (Winchendon, MA)
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I'm just guessing but...

    Okay,

    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.

    JT

  • #4
    New Coder
    Join Date
    Apr 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    Code:
    <script type="text/javascript">
    function Check(MemberItemCode,MemberCode,Store){
      var f = document.Formi;
      f.MemberItemCode.value=MemberItemCode;
      f.MemberCode.value=MemberCode;
      f.Store.value=Store;
      f.submit();
      return false;
    }
    </script>
    ...
    <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>
    ...
    </form>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •