Hi guys,

I have met a problem when i want to customize the form of creating/editing nodes.

Now i have a form for creating nodes of one content type. And there is a cck node reference field(checkbox) in this content type.

And in the form this field displays a list of checkboxes with reference node labels. If i want to use another field of refered content type to replace the labels, how can i do that?

I use form_alter, but it seems not working as expected. because this element's type in the form is nodereference_button and i cann't find out in which attribute it stores the data

and also the data format.

Any suggestions appreciated. Thanks...

Comments

goldhat’s picture

Use the dsm() function provide by the Development (devel) module (http://drupal.org/project/devel) to analyze your form structure from within hook_form_alter. Every field that is included in the form will be listed in the array and dsm() will provide a printout in a collaspible tree that is easy to navigate.


//print out form array using devel module
dsm($form);

When the printout first appears on your screen look at the first level for anything containing "node" or "reference" - I'm not sure what the container element is named for that type.

liaolliso’s picture

It seem that this dsm($form) is the same function with var_dump($form), maybe dsm() has a better outputs.

Thanks anyway!