weierophinney wrote:
>
> Cheat. :)
>
> Subclass your form, and in your init() method do this:
>
> class ReadOnlyForm extends RegularForm
> {
> public function init()
> {
> parent::init();
>
> $this->getElement('foo')->readonly = true;
>
> // ... and so on
> }
> }
>
> If your ACL says that the user has "readonly" access, then load the
> ReadOnly version of the form and assign that to your view instead of the
> regular version.
>
>
If i were to cheat and since the acl is accessible from a global variable.
Wouldn't something like this at the bottom of my forms file and if they were
readonly just do this instead of printing a submit button be just as good?
foreach ($this->getElements() as $name => $data)
{
$this->getElement($name)->readonly = true; //textfields
$this->getElement($name)->disabled = true; //all other fields
}
though I i knew of this method, i was most wondering if there is a "Correct"
way prebuilt in.
--
View this message in context:
http://n4.nabble.com/Forms-and-ACL-tp932394p932463.html
Sent from the Zend Framework mailing list archive at Nabble.com.