2009年2月23日星期一

Re: [fw-mvc] view script and subform nested

Sorry to resurrect an old thread, but I was searching for a solution to my
problem and came across this. I'm trying to get (Dojo) subform elements
rendered with a ViewScript decorator to have their fully-qualified names,
i.e. with the subform array notation.

I'm using the example for the docs, which is something like
....
$textForm = new Zend_Dojo_Form_SubForm();
....
$textForm->addElement(
'DateTextBox',
'datebox',
array(
'value' => '2008-07-05',
'label' => 'DateTextBox',
'required' => true,
)
....


And I've added:
$textForm->getElement('datebox')
//->clearDecorators
->setDecorators(array(
'PrepareElements',
array('ViewScript', array(
'viewScript' =>
'someAction/_someAction-form-element.phtml',
'class' => 'someClassName'
))));


But I'm still not getting the array notation on the input name - the
PrepareElements decorator is having no effect at all.

Does anyone have any advice?

Thanks,
Mark


Colin J wrote:
>
> Hi
>
> Try setting the 'PrepareElements' decorator before handing over to the
> viewScript. This ensures subform elements now have the array notation.
> As an example:
>
> $this->setDecorators(
> array(
> 'PrepareElements',
> array('viewScript', array('viewScript' =>
> 'decorators/myviewscript.phtml'))
> )
> );
>
>
> This is mentioned in the documentation here Zend Framework Decorators (see
> Zend_Form_Decorator_PrepareElements)
>
> Regards
>
> Colin
>
>
> mail@roccogalluzzo.com wrote:
>>
>> hi
>>
>> have build a view script for my subforms with the sintax
>> "<?= $this->element->name_element ?>" for print sub form elements, now
>> work but don't print the subforms with array notation...
>>
>> you know how to do?
>>
>> Thanks
>>
>>
>
>

--
View this message in context: http://www.nabble.com/view-script-and-subform-nested-tp22096665p22157629.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: