Hi. I have two cck fields.
In "node add" form, I need if first field is empty, to take value from second cck field and use it as a value for itself before validation operation.

Practically I have embed video cck field(field A) where I can use youtube or my own video link. But I need my own videos to be on my server, so I have created filefield(fiel B). When I attach a video instead a link to youtube video, I want to use link to that uploaded video in cck embed video field(B). And I want to use it before validation, so I can preview node that I am creating. I was playing with form and forms hooks, but without success. Does anybody know how to do this?

Comments

gforce301’s picture

The Computed Field module for CCK might do the job you need.

It is a very powerful field module that can access any of the fields in a node and even change them at submit time. It "should" hook in before validate, but I am not positive. It does not have to store data for itself and can modify data stored in any field in the node.

Hope this helps
G

Anonymous’s picture

Thank's for the tip, but I don't think that it will help me. I need to write a php snippet anyway, so it doesn't matter if I'll use it in my onw module, or in this module's field(s).

gforce301’s picture

The reason I suggested this is you don't need to mess with form_alter hooks at all to get it to work.

Anonymous’s picture

I think that best way to do this is to use php code as default value for cck embed field(A). But I didn't figured out the right snippet, yet.

Parkes Design’s picture

Did you figure out how to do this using php code as default value?