When I attach my files to the form element and press start upload everything works fine.

If I attach my files and just submit the form, the upload status very quickly goes to 100% (almost immediately) and my form page refreshes. None of my submit functions run.

Comments

slashrsm’s picture

Are you using this on your custom for or with any other contrib module?

Have you tried to use #submit_element? See: #1935256: When a form has more than one submit button plupload always submits using the first one.

matt.h’s picture

Thanks for the reply.

This is in a custom module.

$form['reports'] = array(
  '#type' => 'plupload',
  '#title' => t('Upload files'),
  '#description' => t('YOU MUST HIT START UPLOAD PRIOR TO SUBMITTING FORM!'),
  '#upload_validators' => array(
   	'file_validate_extensions' => array('jpg jpeg gif png txt doc docx docm dotx xltx xls pdf ppt pps pptm xlsx zip xlsm'),
   	 ),
  '#plupload_settings' => array(
        'runtimes' => 'html5,flash,html4',
  
  ),
   );

As you can see, for the time being I have had to educate my users to start upload prior to form submit.

I do have other submit buttons on the form for ajax controls, but I haven't had any issues with it submitting on those. I did try your suggestion with #submit_element => 'edit-submit', but no change.

I also tried one of the patches for Auto Submitting that I found on here, but that just jacked up my form element.

matt.h’s picture

Assigned: Unassigned » matt.h
Status: Active » Fixed

This was solved by using '#submit_element' on my plupload form field.
I apparently can't read or something, and used the wrong submit button ID...who knows. Works fine now.

matt.h’s picture

A tiny bit more detail...when I first tried #submit_element I used 'edit-submit' for the button Id. That obviously didn't work. It needed to be '#submit_element' => '#edit-submit' - with the ID #, in case someone else out there is an airhead like me.

slashrsm’s picture

Great. Nice to hear that it worked.

Would you be prepared to document this? https://drupal.org/node/1647890

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.