Greetings!

I've killed two weekends now trying to engineer what would seem on the surface to be a simple proposition: I need to have a custom CCK field which can hold two images, a video field, and a few text field items. Following the various tutorials (e.g. http://www.poplarware.com/cckfieldmodule.html or http://www.lullabot.com/articles/creating-custom-cck-fields), I can see how to create a custom compound CCK field with a single filefield, but am stumped on how to engineer having multiple.

My efforts so far have been along the lines of trying to create the fields via calls to the various "higher level" filefield object (i.e. imagefield and videofield), then renaming the same-named fields that come back, and then trying to do some creative mapping between the widgets and the fields, but that keeps falling on its face for me.

The point that it's failing at for me appears to be in getting the widget to generate correctly. I've been trying to call the widget functions with various mixes of the $field array, but the most I'm able to get is a file dialog that fails when you click the upload buttons, giving an ahah error that "An HTTP error 0 occurred", which is surprisingly unhelpful. Also, when I compare the contents of the $field object from within my hook_widget implementation with the $field at the same point in the poplarware example from above, I see that I'm missing a lot of values... so maybe I'm not building the field right in the first place?

Surely I'm going about this wrong?

I desperately need to have this functionality, and any help or suggestions are appreciated.

Regards,

Sean P. O. MacCath-Moran
www.emanaton.com

Comments

emanaton’s picture

*tap* *tap* *tap* *tap*

Is this thing on? =oD

WorldFallz’s picture

Have you tried cck v3 's new multigroup feature?

emanaton’s picture

CCK V3 is still in pre-release, isn't it?

WorldFallz’s picture

yep... but it works great already.

emanaton’s picture

Unfortunately, I need this for a production site, and so should not be using non-production-ready code. =o/

Do you (or does anyone) know of any instances in which multiple file-fields have been instituted in a single custom CCK field type, and if so can you point me to this example?

Regards,

jkopel’s picture

I am not sure if you have seen this but there is a good tutorial from jhodgdon here:
http://www.poplarware.com/cckfieldmodule.html

It is not exactly what you want, but it does deal with using image_field (a file_field derivative) in a compound field.

emanaton’s picture

Indeed, that is a good tutorial, and I have seen it (I referenced it in my original issue description). However, it deals with adding a single file field, which is relatively easy. However, things get more complex when trying to add muliple file fields to a single costom field.

kmadel’s picture

Looking for the same thing. For now I have settled on a custom cck field with one filefield, then allow multiple values but enhance the filefield form widget to include a new drop down that specified each individual upload as video or image or mobile video, etc... My next step would be to add validation around mime type and what the user selected as the type for the given file upload.

Flocken’s picture

Hi, I've got the same problem. No ideas? Maybe it is possible, to do something with the delta value. When you have one imagefield and set the number of values to 2 or 3 or unlimited you get an extra table for the images with a delta value. Maybe we could use the same idea.

Or maybe that http://drupal.org/project/image_fupload could be helpful?!