Answer Question
How do I trigger an event which was set up with dojo.connect?
The situation is that I have an html form with a file input field.
I want the form to be submitted asynchronously with dojo, so I connect the dojo ajax call to the onsubmit event of the form element:
dojo.connect(form_elem, 'onsubmit', function(event){dojo.xhrPost({form: form_elem});});
This (though example shown here is incomplete) works when you click the submit button - the file is submitted in the background.
Next thing is, I want to automatically submit the form when the user has selected a file, so I connect the onchange event of the file input element to the onsubmit event of the form:
dojo.connect(input_elem, 'onchange', function(event){input_elem.parentNode.onsubmit()});
(the parentNode is naturally the form element)
This doesn't work! The form element does not have an onsubmit function, even though it has the onsubmit event handler connected by dojo before.
Question is how do I trigger / fire the onsubmit event of the form?
Thanks for your help,
Jakob
NB: I am using the Dojo Toolkit v1.2
TEXT
Uploading file and scanning for virus...
Please Wait