Can we click a link and it will submit the form to the other page?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matt

    Can we click a link and it will submit the form to the other page?

    Can we click a link and it will submit the form to the other page?
    Usually we will submit the
    form to other page by clicking a submit button.

    Now I need to do the following, but what if I have many data in the
    form? Any workarounds?
    <a href="http://myserver/index.jsp?name= test&actionType =test"
    target="_blank" >Add New Document</a>

    Please advise. thanks!!
  • Randy Webb

    #2
    Re: Can we click a link and it will submit the form to the otherpage?

    Matt wrote:
    [color=blue]
    > Can we click a link and it will submit the form to the other page?
    > Usually we will submit the
    > form to other page by clicking a submit button.
    >
    > Now I need to do the following, but what if I have many data in the
    > form? Any workarounds?
    > <a href="http://myserver/index.jsp?name= test&actionType =test"
    > target="_blank" >Add New Document</a>
    >
    > Please advise. thanks!![/color]

    Why not just use a submit button and be done with it?

    --
    Randy
    comp.lang.javas cript FAQ - http://jibbering.com/faq

    Comment

    • kaeli

      #3
      Re: Can we click a link and it will submit the form to the other page?

      In article <ba8a039e.04092 20851.2e7607a8@ posting.google. com>,
      jrefactors@hotm ail.com enlightened us with...[color=blue]
      > Can we click a link and it will submit the form to the other page?
      > Usually we will submit the
      > form to other page by clicking a submit button.
      >
      > Now I need to do the following, but what if I have many data in the
      > form? Any workarounds?
      > <a href="http://myserver/index.jsp?name= test&actionType =test"
      > target="_blank" >Add New Document</a>
      >
      > Please advise. thanks!!
      >[/color]

      Yes, but note that it can die in non-supporting browsers. I don't recommend
      it for the 'net.
      Intranet is fine.

      This is what I do.

      -- actual code from generated page, modified for sensitive content --

      <td>
      <form name='otFrm11' action='admnTyp e.jsp' method='get'>
      <input type='hidden' name='Type' value='WIRELESS '><input type='hidden'
      name='descripti on' value='Wireless '><input type='hidden' name='status'
      value='1'></form>
      <a href="javascrip t:document.form s['otFrm11'].submit();">WIR ELESS</a></td>

      -- end code --

      Note that I am using the javascript protocol for a link. This is not
      recommended for general use and is not very cross-browser. This works in IE6
      and NN7, the only browsers I need to care about. If you need it more cross-
      browser, remove the script from the href and put it in onClick and put a real
      location in the href.
      <a href="someNonJs Page.html" onClick="docume nt.forms['formname'].submit()">

      If the submit (target of the form or a function that opens a new window and
      sets target) is to a different window, add "return false" to the onClick so
      the href isn't followed in the main page.
      <a href="someNonJs Page.html" onClick="docume nt.forms['formname'].submit();
      return false;">

      HTH
      --
      --
      ~kaeli~
      He's your God, they're your rules - you burn in Hell.



      Comment

      Working...