I would like to just say that I thought it would work as:

$("#myform).submit();

inside the onchange event, but it would never submit the form.

Using 

$("#myform)[0].submit(); 

worked immediately. 

Thanks again for your help!

-Marshall

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Klaus Hartl
Sent: Wednesday, October 18, 2006 12:35 PM
To: jQuery Discussion.
Subject: Re: [jQuery] Submitting a form after input type="file" onchange

Paul McLanahan schrieb:
> It did work.  I tried it before submitting the suggestion.  The jQuery

> submit() function works in 2 ways.  If a function is passed it will
set 
> that function to the onsubmit handler, and if no arguments are passed,

> it will call the submit action on the elements.  Your way will work as

> well due to the form element's built in submit function.  But I
believe 
> that my way will not throw an error if the form element is not found 
> because jQuery functions fail silently on and empty set, whereas using

> the [0] to get the dom element first will throw an error if it doesn't

> exist.
> 
> Please let me know if I'm wrong though.  I could very well be.
Though, 
> as I said, I did test my code before offering the suggestion.


Your code may have worked under certain circumstances. jQuery.submit() 
triggers any handlers that were attached via 
jQuery.submit(someFunction). If in the function someFunction the form 
gets submitted than it's going to work out.

But this may change in the future. I think, John filed a bug, that 
jQuery.submit() should also call the built-in FormElement.submit() 
method if available.

Not quite sure if I'm mixing up two different things here. At least 
there was another thread regarding this topic.

If that has changed I really would have to know - it would have quite an

impact on my project. John?


-- Klaus

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to