It gets overwritten because browsers do not send disabled inputs'
values, just like when a checkbox is not checked. Therefore symfony
interprets it as a false.
Overwrite the forms doBind() method, to set the fields current value
in the input (tainted) array.

On Wed, Apr 7, 2010 at 16:13, axel at <axel.zu...@gmail.com> wrote:
> hello,
>
> to disable a checkbox in a form for certain users I use:
>
> if (!user->mayXY() {
>  $this->widgetSchema['active'] = new
> sfWidgetFormInputCheckbox(array(), array('disabled' => 'disabled'));
> }
> to disable editing of the checkbox but still displaying the current
> setting.
>
> the problem is that symfony overwrites the current value with 0 in
> case of form submit!
>
>
> (using symfony 1.4.3
> schema.yml
> active: { type: boolean, notnull: true, default: 0 }
>
> (same problem with sfWidgetFormInput but here it works to set readonly
> new sfWidgetFormInput(array(), array('readonly' => 'readonly', 'class'
> => 'readonly'));)
>
>
> --
> If you want to report a vulnerability issue on symfony, please send it to 
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>
> To unsubscribe, reply using "remove me" as the subject.
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to