It’s common to use hidden value in a form to specify certain variable that was meant to logic which would handle the form processing rather than the user facing the form, hence the name ‘hidden’. Drupal Form API provide special element ‘value’ that can be used for the same task except that the value would not be sent together with the form. Let say you need to main a refference to customer_id when user entering their order in order form, the typical way is to used hidden element like this:-
$form['customer_id'] = array('#type' => 'hidden', '#value' => $customer_id);
This would put the value as a hidden form element and sent along other form value when user submit the form. The alternative is to use the ‘value’ element:-
$form['customer_id'] = array('#type' => 'value', '#value' => $customer_id);
No value would be sent to the browser but it’s still available to the form submit handler just like any other element. Neat idea, I think.
