Topic: Submit Button

Hi, my first posting so please be gentle :-)

First off many thanks to the developers - really great job.

I'm trying to replace my old image uploader with plupload. My old uploader used ImageMagick on the server side for resizing. Having client side resizing is a great feature for me.

The forms I use are pretty simple HTML with a 'standard' submit button. Is there a way in which I can use my submit button to trigger the 'normal' form submission AND the upload files function at the same time?

I have search the forum but cannot see a suitable answer. If someone can point me at example code that would be perfect as I am still learning Javascript.

TIA

Pioden

Re: Submit Button

Am I trying to do the impossible?

<input type="button" value="Submit" name="uploadfiles" onclick="uploader.start()"/>

Uploads my images but not the form

<input type="submit" value="Submit" name="uploadfiles" onclick="uploader.start()"/>

Submits the form but not the images!!

Is pure JavaScript the only way to do what I want?

Re: Submit Button

try what is suggested at the examples:

// Client side form validation
        $('form').submit(function(e) {
            var uploader = $('#uploader').pluploadQueue();
     
            // Files in queue upload them first
            if (uploader.files.length > 0) {
                // When all files are uploaded submit form
                uploader.bind('StateChanged', function() {
                    if (uploader.files.length === (uploader.total.uploaded + uploader.total.failed)) {
                        $('form')[0].submit();
                    }
                });
                     
                uploader.start();
            } else {
                alert('You must queue at least one file.');
            }
     
            return false;
        });

Re: Submit Button

This is where that example is: http://www.plupload.com/example_queuewidget.php