Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 6th, 2004, 12:31 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default Form Submit on Link

I have a page which contain a form and at the end I want to submit it by clicking on a link for this I am using

<a href="#" class="decor2" onClick="submit(this);"> Save & Logout</a>

but this is not working I also tried

<a href="#" class="decor2" onClick="javascript :submit(this);"> Save & Logout</a>
but it also not working.
Please any one who can tel me what am I doing wrong or what should I do to solve this problem
THnaks in Advance.


(*_*)

Numan
--------------------------------------------------
It is not important what you get But important is how you got it
__________________
(*_*)

Numan
--------------------------------------------------
It is not important what you get But important is&nbsp;&nbsp;how you got it
 
Old October 6th, 2004, 03:02 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Numan,

What your code is trying to do is call a submit function and pass the a tag as a parameter to it, if this is what you want, you need a submit function something like...
Code:
function submit(pLink){
    document.forms.myFormName.submit();
}
otherwise you could just change your onclick call to...
Code:
onclick="document.forms.myFormName.submit();"
HTH,

Chris

 
Old October 6th, 2004, 04:47 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

Thanks chris it is working quite nicely

(*_*)

Numan
--------------------------------------------------
It is not important what you get But important is how you got it
 
Old October 6th, 2004, 04:19 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Also if the <a> tag is in the form an easier way is to do this:

<a href="#" class="decor2" onClick="this.form.submit();"> Save & Logout</a>

-Snib <><
http://www.snibworks.com
There are only two stupid questions: the one you don't ask, and the one you ask more than once ;)
 
Old October 6th, 2004, 11:40 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

Its mean that by using
onclick="document.forms.myFormName.submit();"
we can submit any form of the page


(*_*)

Numan
--------------------------------------------------
It is not important what you get But important is how you got it





Similar Threads
Thread Thread Starter Forum Replies Last Post
Form submit into Excel raversunite Infopath 0 August 1st, 2007 05:43 AM
a-link submit grstad Javascript How-To 2 December 14th, 2006 05:19 PM
Form Submit Nitin_sharma Javascript 1 December 2nd, 2004 08:51 AM
How can we submit a form without a submit butto phpsharma BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 4 October 20th, 2003 08:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.