Community & Support

Ho to set default value for CCK File Field via Form API

I have a situation where i want to copy a node by setting default values via Form API. Thats works fine so far. Just now i need to set the CCK File Field. In this case an Image Field. The file is already uploaded from the node i'm trying to copy. What values do i need to set to achieve that?

The copy itself gets done by adding an arg(3) to the node creation form. This gets read my Form API and the default values will be prepopulated.

Comments

I'd suggest using

I'd suggest using hook_form_alter to peek at a populated form with that CCK field filled in, so you know how to fill it. Just make sure it runs after CCK's hook_form_alter.