Closed (duplicate)
Project:
Drupal core
Version:
6.0
Component:
forms system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Feb 2008 at 21:01 UTC
Updated:
25 Feb 2008 at 22:07 UTC
I've got the following code. It works, the fields shows up, but there's no default value, EVER.
function entity_form_alter(&$form, $form_state, $form_id) {
if($form_id == 'entity_node_form') {
$node = $form['#node'];
$form['contact']['entity_telnum'] = array(
'#type' => 'textfield',
'#title' => t('Tel. Number'),
'#default_value' => isset($node->entity_contacts['Tel. Num']) ? $node->entity_contacts['Tel. Num] : 'NO DEFAULT',
'#description' => t('The telephone number of the entity')
);
}
A var_dump of $node->entity_contacts['Tel. Num'] gives string(10) "0123456789"
Comments
Comment #1
scoutbaker commentedDuplicate of http://drupal.org/node/226648.