....
$form['annotate']['note'] = array(
'#type' => 'textarea',
'#title' => t('Notes'),
'#default_value' => isset($node->annotation) ? $node->annotation : '',
'#description' => t('Make your personal annotations about this content here.
Only you (and the site administrator) will be able to see them.')
);

$form['annotate']['nid'] = array(
'#type' => 'value',
'#value' => $node->nid,
);
.....

when create the form, he uses the above code. i don't understand this well and don't know what's aim of the code.

$form['annotate']['nid'] = array(
'#type' => 'value',
'#value' => $node->nid,
);

Comments

larowlan’s picture

Hi
This is a value form field, think of it like a hidden field that is not susceptible to user tampering (like a hidden input field is).
The value fields are available in $form_state['values'] when the form is submitted/validated.
Lee

Lee Rowlands

--author="larowlan <larowlan@395439.no-reply.drupal.org>"