Brian,

This document.siDetailsAdd.submit() will submit the form, but it will not call the 
onSubmit event in the form tag.
As far as I am aware an event trigger does not trigger another event in JavaScript, 
i.e. the submit is triggered by the onClick event, thus not triggering the onSubmit 
event.

So you need to call the function in the onSubmit event manually

<a href="#" id="test" onClick="test_alert(); document.siDetailsAdd.submit()" 
class="link">Add</a>

I know you can trigger events through code, for example if you wanted to trigger the 
onClick event of the above link through code, you could do that like so;

document.getElementById('test').onclick()

Taco Fleur
07 3535 5072
Blog: http://www.tacofleur.com/index/blog/
Methodology: http://www.tacofleur.com/index/methodology/
Tell me and I will forget
Show me and I will remember
Teach me and I will learn


-----Original Message-----
From: KNOTT, Brian [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 24 February 2004 2:02 PM
To: CFAussie Mailing List
Subject: [cfaussie] RE: Javascript problem


It submits the correct form, as it goes to the correct page, it just ignores
the onsubmit attribute in the form tag.  In the below code clicking on the
add will direct the browser to addsi.cfm.  It does not do the
onsubit="test_alert", which pops an alert box that says test.  If I replace
the add link with a normal input type="submit" then it all works.

Brian

<form action="addsi.cfm" method="post" name="siDetailsAdd"
onSubmit="test_alert()">

<a href="#" onClick="document.siDetailsAdd.submit()" class="link">Add</a>

</form>

> -----Original Message-----
> From: Steve Baty [SMTP:[EMAIL PROTECTED]
> Sent: Tuesday, 24 February 2004 13:56
> To:   CFAussie Mailing List
> Subject:      [cfaussie] RE: Javascript problem
> 
> Brian,
> 
> You may need to specify the form to submit, either by
> onclick(this.submit()), or onclick(document.formname.submit());
> 
> Not sure that will help, but worth a shot...
> 
> Cheers
> Steve
> 
> -----------------------------------
> Steve Baty - senior analyst
> p: 612 8596 4030
> m: 0417 061 292
> f: 612 8596 4001
> e: steve @redsquare.com
>  
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of KNOTT,
> Brian
> Sent: Tuesday, 24 February 2004 2:53 PM
> To: CFAussie Mailing List
> Subject: [cfaussie] Javascript problem
> 
> Not sure how many people are out there with MXDU on but I have a
> javascript
> problem.
> 
> I have a onsubmit attribute in my form tag but If I use a link and do a
> onclick(submit()) it ignores the onsubmit in the form tag.
> 
> There are 3 forms on the page but they all have separate form tags, not
> sure
> if these are causing the problem.
> 
> Brian Knott
> 
> 
> 
> 
> ------------------------------------------------------------------------
> -----------
> 
> The contents of this message are the views of the Author and do not
> necessarily reflect the views of SUNCORP METWAY LTD  ABN 66 010 831 722.
> 
> 
> The content of this e-mail, including attachments is a confidential
> communication between the Suncorp Metway Group and the intended
> addressee. Any unauthorised use of the contents is expressly prohibited.
> If you have received this e-mail in error please contact the sender
> immediately and then delete the message and any attachment(s).
> 
> http://www.suncorp.com.au
> 
> 
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
> [EMAIL PROTECTED]
> 
> MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
> http://www.mxdu.com/ + 24-25 February, 2004
> 
> 
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
> [EMAIL PROTECTED]
> 
> MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
> http://www.mxdu.com/ + 24-25 February, 2004

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to