is not used any more and exists only for history. Post new tickets on the Github account. n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#518 closed new feature (fixed)

add the possibility to set the visibility of a form's field in a controller

Reported by: bastnic Owned by: laurentj
Priority: normal Milestone: Jelix 1.1 beta 1
Component: jelix:forms Version: 1.0.2
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:


Sometimes, I need to hide a field in a form for someone who have not enough rights to change the value. So I have to create another form.

It could be great if we can do $form->getControl('mycontrol')->visibility = false, or something like that.

That's just an idea. What do you think about that ?

Change History (6)

comment:1 Changed 14 years ago by laurentj

Why not. But I think we should have a method instead of a simple property.

With a simple property, on actions which retrieves submitted datas, you have to check again rights to set the visibility property on field in your controller, so the initFromRequest method could modify only datas from visible controllers, to avoid security issues. (properties on control objects are not persistent between two actions).

This is not terrible, to repeat at each action this "visibility" setting.

So I think it is better to have a setVisibility() method (on jFormsBase ?). This method won't set a property on the control object itself, but will set this property in the data container (the object which is stored in sessions). So in other actions, we don't have to setup the visibility status again and again.

comment:2 Changed 14 years ago by laurentj

  • Owner set to laurentj
  • Status changed from new to assigned

comment:3 Changed 13 years ago by laurentj

  • Resolution set to fixed
  • Status changed from assigned to closed

New feature landed in the trunk: there are some new method jFormsBase::deactivate() an jFormsBase::isActivated().

comment:4 Changed 13 years ago by bastnic

Thanks you.

comment:5 Changed 13 years ago by laurentj

  • Documentation needed set
Note: See TracTickets for help on using tickets.