Posted by D.H. on July 4, 2011 at 10:53am
2 followers
Jump to:
| Project: | ImageField |
| Version: | 6.x-3.9 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I'm using a custom form for editing content in a project and want to build in an cck image upload. So far I'm using the following code:
$element = content_fields('field_image', MY_NODE_TYPE);
$form['#field_info']['field_image'] = $element;
$element = (array) content_field_form($form, $form_state, $element);
$form['field_image'] = $element['field_image'];This displays 2 upload-fields + 1 "add more" button.(all ajaxified) When I'm trying to upload an image via the first 2 fields the preview of the image isn't shown afterwards.
When I use the "add more" to add a new field the first 2 fields start to work again.
So my question is: What exaclty is neccessary to get the two fields to work initially? Might be some AHAH/Ajax behviours?!
Comments
#1
ImageField (or generally all CCK fields) are not designed to work outside of the node form. In Drupal 7 we have a nice #type = 'managed_file' that provides a global AJAX-upload field, but what you're trying to do isn't supported in Drupal 6.
#2