This issue is resolved.
 
Regards
Austin.
 
 
Hi
I found that value is retreived properly, but when I increment it by 1 it does not work.
 
My code in hook_form_alter is as below.
 
 if($form_id == myformid)
 {
    $form_state['values']['companies'] = $form_state['values']['companies'] + 1;
 }
 
Is this the way values can be incremented, or I need to follow any particular
 


 
On Tue, Mar 15, 2011 at 7:10 AM, Austin Einter <austin.einter@gmail.com> wrote:
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