ZendX Jquery Decorator

Posted by iJD on Stack Overflow See other posts from Stack Overflow or by iJD
Published on 2010-10-13T02:19:47Z Indexed on 2011/02/07 7:25 UTC
Read the original article Hit count: 233

Filed under:
|
|
|
|

How use partial decorator in Jquery Element

I use this code for Form Element:

    $title = new Zend_Form_Element_Text('title');
    $title->setRequired(true)
            ->setAttrib('class', 'inputbox')
            ->setLabel('Title');
    $title->viewScript = 'RegElement.phtml';
    $title->setDecorators(
            array(
                array('ViewScript', array('class' => 'RegElement'))
            )
    );

But when i use Jquery Element i dont know how implement it:

    $datePicker = new ZendX_JQuery_Form_Element_DatePicker(
                    "datePicker1", array("label" => "Date:")
    );
    $datePicker->viewScript = 'RegElement.phtml';
    $datePicker->setDecorators(
            array(
                array('ViewScript', array('class' => 'RegElement'))
            )
    );

    //views/scripts/RegElement.phtml
    <li class="row <?php echo $this->class ?>">
        <div class="cont-error">
         <?php echo $this->formErrors($this->element->getMessages()); ?>
        </div>
        <div class="rowfields">
           <?php echo $this->formLabel($this->element->getName(),
                      $this->element->getLabel()) ?>
        <?php
            echo $this->{$this->element->helper}(
                 $this->element->getName(),
                 $this->element->getValue(),
                 $this->element->getAttribs()
             )
         ?>
        </div>
        <div class="hint"><?php echo $this->element->getDescription() ?></div>
    </li>

And display this error:

Warning: Exception caught by form: Cannot render jQuery form element without at least one decorator implementing the 'ZendX_JQuery_Form_Decorator_UiWidgetElementMarker' interface.

I need display datePicker with same format. but idk how implement this interface. thx for your help.

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery