Reynier Perez Mira wrote:
> Hi every:
> I try to hide a widget if a user (managed by sfGuard) has not "administrador"
> privileges. For that in my Form class named TbReservacionForm.class.php I do
> this:
>
> $context = sfContext::getInstance();
> $user = $context->getUser();
>
> if (!$user->hasCredential('administrador')) {
> unset($this['estado_reservacion']);
> }
>
> But I get this error:
> 500 | Internal Server Error | InvalidArgumentException
> Widget "estado_reservacion" does not exist.
>
> The funny part here is that I check the BaseTbReservacionForm class and see
> the code for Widgets:
>
> $this->setWidgets(array(
> 'id_reservacion' => new sfWidgetFormInputHidden(),
> 'id_profesor' => new sfWidgetFormPropelChoice(array('model'
> => 'sfGuardUser', 'add_empty' => false)),
> 'id_edificio' => new sfWidgetFormPropelChoice(array('model'
> => 'TbEdificio', 'add_empty' => false)),
> 'id_apartamento' => new sfWidgetFormPropelChoice(array('model'
> => 'TbApartamento', 'add_empty' => false)),
> 'id_complejo_comedor' => new sfWidgetFormPropelChoice(array('model'
> => 'TbComplejoComedor', 'add_empty' => false)),
> 'desayuno' => new sfWidgetFormInputCheckbox(),
> 'almuerzo' => new sfWidgetFormInputCheckbox(),
> 'comida' => new sfWidgetFormInputCheckbox(),
> 'estado_reservacion' => new sfWidgetFormInputCheckbox(),
> 'motivo_reservacion' => new sfWidgetFormTextarea(),
> 'fecha_entrada' => new sfWidgetFormDateTime(),
> 'fecha_salida' => new sfWidgetFormDateTime(),
> 'carne_identidad' => new sfWidgetFormInput(),
> 'nombre_visitante' => new sfWidgetFormInput(),
> 'id_parentezco' => new sfWidgetFormPropelChoice(array('model'
> => 'TbParentezco', 'add_empty' => false)),
> 'sexo' => new sfWidgetFormInput(),
> ));
>
> So "estado_reservacion" exists and really I don't know where is the problem.
> Can any help me to solve this?
>
> Cheers and thanks in advance
> Ing. Reynier Pérez Mira
> Dirección Técnica IP
Where did you put this code? I mean in which method in the class?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---