Archived from the Transloadit support forum. Originally posted on December 28, 2011; details may be outdated, see our docs for current behavior. Original thread
I currently have an existing form with several text fields and using the jQuery validate plugin to validate the form and submit the data with ajax. I’m hoping to integrate the transloadit jQuery plugin to add a video upload field into the form.
Currently I’m running $(‘#submit’).transloadit({params}) on page load with autoSubmit set to false then adding the returned assembly ID to a hidden field and submitting the remaining fields of the form via javascript.
This method however is 2 step - 1. Select file and click upload. 2. Fill in remaining form fields and click submit.
In order to make this a 1 step process, I need a way to fire the transloadit method from dynamically from the onSubmit method of the validate javascript plugin, rather than using the form selector ID.transloadit on document.ready.
Make sure to use autoSubmit: true with that. Once the upload is finished transloadit will submit the form again when you have autosubmit. Since you have unbound transloadit, it will just call the submitHandler of the jQueryValidate plugin. As you have set the self.uploadFinished property to true, it will call form.submit(), which essentially submits the entire form including upload data.
Thanks for your quick response. Your suggestion worked perfectly. I actually altered the logic slightly so that the following block of code was executed as part of the submitHandler method of the validate plugin…