I prefer to do it using this function rather than submitting the entire form
to the action stated in the form tag. Mainly because I may have multiple
submits per pages submitting to various pages

function FunctionName() {
                        document.forms[0].action="SomeFile.cfm";
                        document.forms[0].method="Post";
                        document.forms[0].submit();
                        }

'forms[0]' will find the first instance of a form where as
'document.formname' will find whatever form you wish to submit.

then the link will need to state

<A HREF="javascript:FunctionName()">Link</A>

hope this helps,

chris.alvarado
cold.fusion - developer
[phone] 512.794.6563
[email] [EMAIL PROTECTED]
[web] http://www.tmanage.com


Privileged/Confidential Information may be contained in this message. It is
not for use or disclosure outside TManage without a written proprietary
agreement.  If you are not the addressee indicated in this message, or agent
responsible for delivery, you may not copy or deliver this message to
anyone.  Please notify the sender as soon as possible and immediately
destroy this message and its attachments entirely.



-----Original Message-----
From: David Shadovitz [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 03, 2000 10:03 AM
To: CF-Talk
Subject: Re: Submitting form with Javascript


Brett,

That's no problem.  Add a hidden element to the form, with a name but no
value.  Set the appropriate value in each of the onclick handlers.  The
form's action page should then check the value of the hidden form
element.

<input type="hidden" name="submitType">

<a href="#"
onclick="document.myForm.submitType.value='A';document.myForm.submit();re
turn false;">Click to submit A</a>
<a href="#"
onclick="document.myForm.submitType.value='B';document.myForm.submit();re
turn false;">Click to submit B</a>

The action page can check the value of FORM.submitType and act
accordingly.

-David

On Fri, 03 Nov 2000 22:28:50 +0800 Brett Payne-Rhodes <[EMAIL PROTECTED]>
writes:
> This is a question I have been wondering about for a while myself...
> Thanks to Peter, Rob and David for their contributions, and I have
> managed to use the solution on a simple form. But what about a more
> complicated form that has three 'submit' buttons; 'Add' 'Update' and
> 'Delete'? Using the standard 'input type="submit"' method you
> differentiate between the buttons by value, but it seems that when 
> using
> the javascript solution I don't see the 'button' that was pressed, 
> even
> if I name the images. I had a look in Goodman's Javascript Bible but
> found little to help - but its a big book and I'll keep looking...
> 
> In the meantime, can anyone shed any more light on this please?
> 
> Many Thanks,
> 
> Brett Payne-Rhodes
> B)
> 
> "Joseph J. Sanger, M.D." wrote:
> > 
> > This is simple, but I am not a javascript maven .... I wish to 
> submit
> > a form by clicking in a link, rather than pressing the submit 
> button.
> > Isn't this possible with some javascript function in the URL of 
> the
> > anchor?  Could someone remind me what this should look like?  
> Thanks
> > very much.

________________________________________________________________
YOU'RE PAYING TOO MUCH FOR THE INTERNET!
Juno now offers FREE Internet Access!
Try it today - there's no risk!  For your FREE software, visit:
http://dl.www.juno.com/get/tagj.
----------------------------------------------------------------------------
--------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a
message with 'unsubscribe' in the body to [EMAIL PROTECTED]
------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to