The proposed solution is the non-integrated way to use JQuery with any form (not Zend_Form in particular).

You should look at the ZendX library and the integrated JQuery solution. This will give you a ZendX_JQuery_Form and a ZendX_JQuery_Form_Element_DatePicker

       $elem = new ZendX_JQuery_Form_Element_DatePicker('begin');
       //$elem->setJQueryParam('changeMonth', true);
       $elem->setJQueryParam('changeYear', true);
$elem->setLabel('begin')->setValue($dummy->begin);//$dummy is my default database object
       $this->addElement($elem);//$this is a ZendX_JQuery_Form

-Bart

Ehask71 schreef:
You should be able to place the Javascript and tell it to use date_start

Here is one of my templates vehicle.phtml

<script type="text/javascript">
$(document).ready(function(){
        $('#ship_date').datepicker({dateFormat: 'yy-mm-dd'});
});
</script>
<?=$this->vehicleForm->render()?>

Of course make sure you have the included files in the layout head for the
datepicker

Eric Haskins



Simeon Goranov-3 wrote:
Hello,
I am interested in creating a form with a calendar element. I decided to
use jQuery date picker, but I don't know how to integrate it into the
form. Bellow is the form code:

        $form = new Zend_Form();
        $form->setName('form_add_service');
        $form->setMethod('post');    

        $element = new Zend_Form_Element_Text('date_start');
        $element->setLabel('Start Date');
        $element->setRequired(true);
        $form->addElement($element);

I want to "tell" to the element to be jQuery date picker. Is there any
way to do it ?

Thanks in advance,
S.G.





Reply via email to