submitVar - If is set, will not begin form processing if this POST variable is not passed. Notice: Needed if you use &store property (+ set submit var in input = "submit"!).
Change the submit button to type = "button" and set onclick = "$('#someID').uploadifyUpload()"
Set the onAllComplete option to submit the form.
[[!FormIt? &submitVar=`uploadbtn` &hooks=`uploadTracks,redirect` &redirectTo=`44` &placeholderPrefix=`fi.` &validate=`nospam:blank` ]]
<form id="uploadform" action="[[~[[*id]]]]" method="POST" enctype="multipart/form-data"> <!-- nospam hidden field --> <input type="hidden" name="nospam" value=""> <!-- upload with uploadify field --> <input id="file_upload" type="file" name="uploaded_files" /> <div class="controls "> <a href="javascript:$('#file_upload').uploadifyClearQueue();" title="Clear Queue">Clear Queue</a> </div> <div id="upload_queue"></div> <input type="submit" name="uploadbtn" value="Upload and Submit" onclick="$('#file_upload').uploadifyUpload()" class="btn dark_btn"> </form> </div>
<!-- uploadify --> <script type="text/javascript" src="/assets/plugins/uploadify/v214/swfobject.js"></script> <script type="text/javascript" src="/assets/plugins/uploadify/v214/jquery.uploadify.v2.1.4.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#file_upload').uploadify({ 'uploader' : '/assets/plugins/uploadify/v214/uploadify.swf', 'script' : '/assets/plugins/uploadify/v214/uploadify.php', 'cancelImg' : '/assets/plugins/uploadify/v214/cancel.png', 'expressInstall' : '/assets/plugins/uploadify/v214/expressInstall.swf', 'folder' : '/assets/uploads/uploadify-test', 'fileDataName' : 'Filedata', 'fileExt' : '*.mp3', 'fileDesc' : 'Music File (.MP3)', 'multi' : true, 'queueID' : 'upload_queue', 'queueSizeLimit' : 20, 'simUploadLimit' : 3, 'method' : 'post', 'removeCompleted' : false, 'sizeLimit' : 10240000, 'auto' : false, 'hideButton' : false, 'displayData' : 'percentage', 'onDialogClose' : function(queue) { $('#status_message').text(queue.filesQueued + ' files have been added to the queue.'); }, 'onQueueComplete' : function(stats) { $('#status_message').text(stats.successful_uploads + ' files uploaded, ' + stats.upload_errors + ' errors.'); }, 'onAllComplete' : function(event,data) { document.getElementByID('uploadform').submit(); } }); }); </script>
<form id="uploadform" action="[[~[[*id]]]]" method="POST" enctype="multipart/form-data"> <!-- nospam hidden field --> <input type="hidden" name="nospam" value=""> <!-- upload with uploadify field --> <input id="file_upload" type="file" name="uploaded_files" /> <div class="controls "> <a href="javascript:$('#file_upload').uploadifyClearQueue();" title="Clear Queue">Clear Queue</a> </div> <div id="upload_queue"></div> <input type="submit" name="uploadbtn" value="Upload and Submit" id="uploadformsubmit" class="btn dark_btn"> </form> </div> <!-- uploadify --> <script type="text/javascript" src="/assets/plugins/uploadify/v214/swfobject.js"></script> <script type="text/javascript" src="/assets/plugins/uploadify/v214/jquery.uploadify.v2.1.4.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#uploadformsubmit').click(function(e){ $('#file_upload').uploadifyUpload(); e.preventDefault(); }); $('#file_upload').uploadify({ 'uploader' : '/assets/plugins/uploadify/v214/uploadify.swf', 'script' : '/assets/plugins/uploadify/v214/uploadify.php', 'cancelImg' : '/assets/plugins/uploadify/v214/cancel.png', 'expressInstall' : '/assets/plugins/uploadify/v214/expressInstall.swf', 'folder' : '/assets/uploads/uploadify-test', 'fileDataName' : 'Filedata', 'fileExt' : '*.mp3', 'fileDesc' : 'Music File (.MP3)', 'multi' : true, 'queueID' : 'upload_queue', 'queueSizeLimit' : 20, 'simUploadLimit' : 3, 'method' : 'post', 'removeCompleted' : false, 'sizeLimit' : 10240000, 'auto' : false, 'hideButton' : false, 'displayData' : 'percentage', 'onDialogClose' : function(queue) { $('#status_message').text(queue.filesQueued + ' files have been added to the queue.'); }, 'onQueueComplete' : function(stats) { $('#status_message').text(stats.successful_uploads + ' files uploaded, ' + stats.upload_errors + ' errors.'); }, 'onAllComplete' : function(event,data) { document.getElementByID('uploadform').submit(); } }); }); </script>
document.getElementByID('uploadform').submit();
$('#uploadform').submit();
console.log
[[!+fi.error_message:notempty=`<span>[[!+fi.error_message]]</span>`]]
$formtestinput = $hook -> getValue('formtestinput '); $hook->addError('error_message',$formtestinput ); return true;
<input name="formtestinput" type="text" value="[[!+fi.formtestinput:default=`If you see this above the form it is working!`]]">