Module works great when editing a node, but it doesn't work when creating a new one and using field collection. Clicking on a Remove-Button just reloads the page.
Steps to reproduce:
1. Create a node type YOURTYPE with a field collection
2. Attach an image field with unlimited values to the field collection
3. Go to http://www.example.com/node/add/YOURTYPE
4. Add some images to the image field (i used filefield sources for this)
5. Try to remove one image => page will be reloaded
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 1370396.patch | 1.78 KB | swentel |
Comments
Comment #1
labor b commentedI did some further testing on a clean install and managed to fix this issue.
It works when I put drupal_add_js into a hook_init or hook_form_alter function.
I'm not that familiar with Drupal.behaviors, but it seems like the function has to be present before adding new files.
Comment #2
labor b commentedDon't think my solution is best practice, but in case someone needs a quick fix:
Just attach this to files_undo_remove.module.
Comment #3
swentel commentedHere's a patch. I've moved the css and js file to the hook_init(), because this would also fail on an existing node edit which has no files attached yet.
While hook_init() is kind of annoying in a way, there's no other place (well, maybe attach_form or so, but still). With css and js aggregation on, this is not really a big penalty. I'll put out a new release soon!