[support] Form Doubt

Austin Einter austin.einter at gmail.com
Tue Mar 15 01:40:45 UTC 2011


Hi All
As per form quickstart guide, forms can have #type as 'values'.

Example:

<?php
$form['foo'] = array('#type' => 'value', '#value' => 'bar')
?>

Later point of time, we can retreive the value as
$form_state['values']['foo'], and value retreived should be 'bar'.

In my module hook_form api, I have added

 $form['companies'] = array(
 '#type' => 'value',
 '#value' => '1',
 );
In hook_form_alter, I want to get the value of
$form_state['values']['companies'] and increment
$form_state['values']['companies'] by 1.
Is this allowed or Drupal has any restriction.

When I access the value of $form_state['values']['companies'], it just gives
me empty value ('').

What could be problem here?

Regards
Austin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20110315/25330bb8/attachment.html 


More information about the support mailing list