Hidden Element not submitted on Drupal Form

Hidden elements can be easily created on a Drupal form. When the form is submitted, $form_state variable seems to be holding the value of this element in various hooks, "form_alter", "validate", etc.

Note that if you have an ajax call or a jquery code which assigns or modifies the value of the hidden element, this value will not be sent when the form is submitted. For eg, An hidden element is created from -

$form['field'] = array(
  '#type' => 'hidden',
  '#value' => 0,

And the doc from the drupal says -

Note that if you plan to use JavaScript to change your hidden element's value, you will need to use the #default_value property rather than #value.

To make your hidden element submit your jquery updated value to $form_state variable, you need to make use of #default_value property instead of #value.

$form['field']['#default_value'] = 0;

This field can now be updated on form load using jquery and the updated value will be seen in $form_state after submission.