1) Ajax submit -- on submit, plupload triggers upload of files. However, it doesn't stop any other submit handlers while doing that, so ajax submit /continues/ as plupload uploads, submitting the form. I tried adding a stop immediate propagation, but if ajax is added first (as it is when using a ctools modalframe, as the plupload js is added on modal open whereas the ajax is already added), so need to have the plupload submit handler run first.

2) (edit: see comments, was addressed in dev) Perhaps realted to #2272043: Image wont upload after size restriction warning, the ids of the element keep changing, so doesn't match the previous ids. Would there be a way it instead uses the name of the element for the new element names, instead of the id?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hefox’s picture

Looks 2 was at least partially addressed via #2063161: Multi Upload with plupload broken when using Drupal 7.23, though I worry if about multiple forms of same type on same page, not sure that'll work with that logic but haven't tested it

hefox’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
565 bytes

Patch for 1), reordering it so plupload submit goes before ajax.

csedax90’s picture

Status: Needs review » Needs work

I've a problem with the latest patch and jQuery Dialog, when I do:

    $form = drupal_get_form('mafra_media_lib_upload_form', $container);
    $html = render($form);
    $html = '<div id="mafra_media_dialog_container">'.'<div class="content processed ">'.$html.'</div>'.'</div>';

    $commands = array();
    $argomenti = array();
    $argomenti['html'] = $html;

    $commands[] = ajax_command_invoke(NULL, "createContainerIfNotExists");
    $commands[] = ajax_command_replace('#mafra_media_dialog_container', $html);
    $commands[] = ajax_command_invoke(NULL, "openMafraMediaDialog", array($argomenti));

    return array('#type' => 'ajax', '#commands' => $commands);

the form is rendered correctly in my div but the latest ajax_command_invoke is ignored.

If I remove the latest patch line, the command is invoked, but the plupload submit doesn't work...

clfer’s picture

FileSize
365 bytes

#2 patch will only stop propagation when the submit trigger the file upload.
When autosubmit is enabled, ajax submit is still triggered even if file upload has not ended.

I think we should stop propagation whenever pluploadform submit function try to return false.

(No idea for #3 sorry)

A----’s picture

$(this).data('events') doesn't work since jQuery 1.7. You can use the unsupported $._data(this, 'events') that works (for now):

($(this).data('events') || $._data(this, 'events')).submit.reverse();