Form element with type = value odd behaviour I have 2 forms on the site, each of them has an array, that I want to store inside the form to use in form_submit function:

$form['store'] = array(
  '#type' =&gt; 'value',
  '#value' =&gt; $fields
);


But in one form_submit function this works:

$fields = $form_state['values']['store'];
unset($form_state['values']['store']);


In another one it doesn't work, giving an error:


  Notice: Undefined index: store in scores_search_form_submit


While this code works:

$fields = $form_state["complete form"]["store"]["#value"];
unset($form_state["complete form"]["store"]);


Why does this happen?
You can use form properties:

$form['#mystore'] = $fields;


The form properties are not sent to the client, but are available in the submit hander. For example, core use $form['#node'], $form['#user'], etc.

Updated:

http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html#val


  Note that as of Drupal 6, you can also simply store arbitrary
  variables in $form['#foo'] instead, as long as '#foo' does not
  conflict with any other internal property of the Form API.


Updated 2:

Your problem may be related to this issue: http://drupal.org/node/1381830