Thank you for your work!

I have tried to edit a node with an image field in modal dialog and it doesn't work when I try to modify the image (delete old image and load new one.).

Thank you.

Comments

restyler’s picture

I confirm the bug.

Steps to reproduce:

1) create a node type, attach image field to this node type
Basically, the image field has "upload" button near the file selector which works via ajax (I'm talking about core field functionality now). So, user can upload the image by clicking "upload" near the file - and gets ajax upload then, or click "save" to save entire node, with file being uploaded in normal way (without ajax)

2) create "edit in dialog" link, implement dialog ajax callbacks for the node type.
try to edit/create the node.
if you upload the file using ajax "Upload" button near file selector, and then click "Save" - the file is saved without any problems.
But! if you click "Save" to save the whole node, the image is not attached to the node, and the image field is empty now.

restyler’s picture

after some research I think that the problem is that ajax form submit used by dialog api doesn't handle form uploads well.
So, in my case, I just switched to normal form submit with page reload for this dialog. But I think that file uploads should be handled by dialog api!

andypost’s picture

Probably you should use ctools_modal_form_wrapper() to handle this correctly

thetoast’s picture

ctools_modal_form_wrapper() won't help. I'm using ctools modal to show a node form with an image upload using ctools_modal_form_wrapper, and I get the same error reported in this comment. Both are possibly related.

lexa.mihu’s picture

i have the same problem :|

eO_Ae’s picture

Same problem. Can't find a solution.

eO_Ae’s picture

This ended up being a javascript error for me.

I had tried using ctools modal to do this, but ended up trying to do it on my own with jquery.ui and the dialog() method.
My version of drupal was failing to add jquery ui.dialog

I used
drupal_add_library('system', 'ui.dialog')

and it was fixed.

When I was using ctools to try this, I was having a similar problem where I thought jquery.once for drupal 7 was not loading. could be a similar javascript error breaking ctools mid stride.

mustanggb’s picture

Issue summary: View changes
Status: Active » Fixed

Think this is fixed in the latest dev, please feel free to re-open if this is not the case.

Status: Fixed » Closed (fixed)

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