<matthew@zend.com> wrote:
> -- Ed Lazor <edlazor@internetarchitects.biz> wrote
> (on Wednesday, 04 February 2009, 03:54 PM -0800):
>> Any idea why the DateTextBox only works when I add line 4?
>>
>> 1 $holiday = new Zend_Dojo_Form_Element_DateTextBox("holiday");
>> 2 $holiday
>> 3 ->setLabel('Holiday:')
>> 4 ->setAttribs(array("dojoType"=>"dijit.form.DateTextBox"));
>> 5
>> 6 $this->addElements(array($holiday));
>
> No ideas whatsoever; I've used it fine without setting that attribute.
>
> How are you configuring your view object and the dojo view helper?
In the bootstrap:
$view = Zend_Layout::getMvcInstance()->getView();
Zend_Dojo::enableView($view);
In the controller:
$form = new Zend_Dojo_Form();
$form->addElement('DateTextBox', 'date1', array(
'label' => 'Choose a date:',
'datePattern' => 'yyy-MM-dd',
'validators' => array('Date'),
'required' => true
));
$this->view->form = $form;
In the view:
<?php echo $this->form; ?>
In the layout:
<script type="text/javascript"
src="/js/dojo-release-1.2.3-src/dojo/dojo.js"
djConfig="parseOnLoad: true">
</script>
<script type="text/javascript">
dojo.require("dojo.parser");
dojo.require("dijit.form.DateTextBox");
</script>
<link rel="stylesheet" type="text/css"
href="http://o.aolcdn.com/dojo/1.0.0/dijit/themes/tundra/tundra.css">
没有评论:
发表评论