Widget's setDefault method not work for HIDDEN fields

Discussion relating to version 1.3.x and 1.4.x

Widget's setDefault method not work for HIDDEN fields

Postby ilnur » Sun Nov 01, 2009 7:01 pm

$this->widgetSchema['hidden_field']->setDefault('1') method not work for HIDDEN FIELDS, when called from Form class.

only works when form outputs with <?php echo $form ?>

and also works when calling <?php $form->setDefault('hidden_field', '1') ?> from action class.
Last edited by ilnur on Mon Nov 02, 2009 2:55 am, edited 1 time in total.
ilnur
Junior Member
 
Posts: 8
Joined: Sat Jul 26, 2008 12:16 pm
Location: Russia

Re: Widget's setDefault method not work for HIDDEN fields

Postby Levelx » Sun Nov 01, 2009 8:08 pm

The syntax in the form-class is:

$this->setDefault('hidden_field', $value);

http://www.symfony-project.org/forms/1_2/en/01-Form-Creation #chapter_01_sub_defining_default_values_for_fields
Levelx
Faithful Member
 
Posts: 359
Joined: Thu Apr 30, 2009 4:22 pm
Location: Germany

Re: Widget's setDefault method not work for HIDDEN fields

Postby ilnur » Mon Nov 02, 2009 2:58 am

thanks, works
ilnur
Junior Member
 
Posts: 8
Joined: Sat Jul 26, 2008 12:16 pm
Location: Russia


Return to symfony 1.3 and 1.4

Who is online

Users browsing this forum: No registered users and 9 guests