Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Can we click a link and it will submit the form to the other page?

Reply
Thread Tools

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

 
 
Matt
Guest
Posts: n/a
 
      09-22-2004
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!!
 
Reply With Quote
 
 
 
 
Randy Webb
Guest
Posts: n/a
 
      09-22-2004
Matt wrote:

> 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!!


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

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
 
Reply With Quote
 
 
 
 
kaeli
Guest
Posts: n/a
 
      09-22-2004
In article <(E-Mail Removed) >,
http://www.velocityreviews.com/forums/(E-Mail Removed) enlightened us with...
> 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!!
>


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='admnType.jsp' method='get'>
<input type='hidden' name='Type' value='WIRELESS'><input type='hidden'
name='description' value='Wireless'><input type='hidden' name='status'
value='1'></form>
<a href="javascript:document.forms['otFrm11'].submit();">WIRELESS</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="someNonJsPage.html" onClick="document.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="someNonJsPage.html" onClick="document.forms['formname'].submit();
return false;">

HTH
--
--
~kaeli~
He's your God, they're your rules - you burn in Hell.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
submit 1 form to 2 servers or 2 forms to 2 server (1 form each) on 1 submit abansal.itp@gmail.com Javascript 3 06-23-2007 07:29 AM
One CheckBox. one ImageButton. Why I can't force the user to click the agreement before submit form? Benny Ng ASP .Net 4 05-23-2006 02:52 PM
submit the form data to the popup window without a submit button jrefactors@hotmail.com HTML 2 01-01-2005 06:07 AM
Preventing Multiple submit (Disabling Submit Button Post Click) Solution Mark ASP .Net 1 12-13-2004 08:03 PM
Can we click a link and it will submit the form to the other page? Matt HTML 1 09-22-2004 05:24 PM



Advertisments