Change select options within a nodereference
Sunday, 14 February, 2010 - 17:34
First you'll have to make use of hook_form_alter() function.
function example_form_alter(&$form, $form_state, $form_id) { $form['field_example_reference']['#pre_render'] = array('example_change_node_reference'); }
Now the node reference will look for a example_change_node_reference() function which will return an array of options.
function example_change_node_reference($element) { $element['nid']['nid']['#options'] = array($node->;nid => $node->title); return $element; }
Make sure you pass the $element variable into the function. More info: http://drupal.org/node/339730.
Version:
Add new comment