-- Edward Haber <[EMAIL PROTECTED]> wrote
(on Sunday, 12 October 2008, 08:48 AM -0400):
> I noticed this problem when using the normal Zend Form Element stack of 
> decorators on a form a that a dijit element in it (specifically it was 
> the DateTextBox). For example, I was trying to add Description  
> decorators to my Zend_Dojo_Form. The form is a mix of regular Zend_Form 
> elements and Dojo elements.
>
> If you put a global elements decorator declaration at the end of the  
> element declarations like so:
>
> class forms_AdminArticleForm extends Zend_Dojo_Form
> {
>       public function __construct($options = null)
>       {
>               parent::__construct($options);
>
>               $this->setName('article_form')
>                       ->setAction(URL.'/admin/article/save')
>                       ->setMethod('post')
>                       ->addPrefixPath('MF_Form_Element', 'MF/Form/Element/', 
> 'element')
>                       ->setAttrib('id', 'article-form');
>               
>               ... declare some elements here ...
>
>
>               $this->setElementDecorators(array(
>                   'ViewHelper',

Here's the problem right here. The Dijit form elements all use the
DijitElement decorator as their base decorator. This is because the
dijit view helpers have a different signature than other form view
helpers (in order to accomodate a separation between dijit parameters
and HTML attributes). Using setElementDecorators() on a mixture of
Zend_Form and Zend_Dojo_Form elements is going to be problematic as a
result.

>                   'Description',
>                   'Errors',
>                   array('HtmlTag', array('tag' => 'dd')),
>                   array('Label', array('tag' => 'dt')),
>               ));
>       }
> }
>
> It will trigger the exact error you mention. What I did was remove  
> global decorators for the form and set decorators on a per element basis 
> (only on the form elements that needed a description field). For Dojo 
> elements, the decorator stack is slightly different:
>
>
>               /**
>                * creationdate
>                */
>               $this->addElement('DateTextBox', 'creationdate', array(
>                       'label' => 'Creation Date',
>                       'description' => 'Leave blank for current date',
>                       'decorators' => array(
>                           'DijitElement',
>                           'Description',
>                           'Errors',
>                           array('HtmlTag', array('tag' => 'dd')),
>                           array('Label', array('tag' => 'dt')),
>                       )
>               ));
>
> This fixed the problem but I had that nagging feeling something deeper  
> must not be right either with the way I was approach my form, something I 
> hadn't included, or some problem with ZF. For one thing, it would be nice 
> to be able to describe one set of element decorators for all the form 
> elements at once (since Zend_Form and Zend_Dojo_Form are supposed to be 
> someone interchangeable).
>
> Eddie
>
> On Oct 12, 2008, at 4:32 AM, Benjamin Eberlei wrote:
>
>> On Sunday 12 October 2008 01:36:27 rswarthout wrote:
>>> When I try to use any Dojo enabled field I receive an error that  
>>> just does
>>> not make any sense.
>>>
>>> PHP Catchable fatal error:  Argument 4 passed to
>>> Zend_Dojo_View_Helper_DateTextBox::dateTextBox() must be an array,  
>>> null
>>> given in Zend/Dojo/View/Helper/DateTextBox.php on line 64
>>>
>>> Any insight would be greatly appreciated.
>>>
>>> Robert
>>
>> are you ultimately using the view helper or the form element?
>>
>> 1.) if using the view helper, you have to specify $this- 
>> >dateTextBox($id,
>> $value, array(), array()); if you want to pass no information to the  
>> attribs
>> or dijit fields.
>>
>> $this->dateTextBox($id, $value, null, null); is not allowed
>>
>> 2.) if you are using Form: are you setting 'attribs' or 'dijitParams' 
>> => null
>> in the configuration of the form element? this leads to the problem  
>> described
>> above. you ahve to set it to => array() to explicity stating its  
>> emptiness.
>>
>> greetings
>> Benjamin
>>
>> -- 
>> Benjamin Eberlei
>> http://www.beberlei.de
>

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to