PDA

View Full Version : Using ExtJS components in Zend_Form script



emile1986
21 May 2010, 7:51 AM
Hello all,

I am wondering if it's possible to use the ExtJS DatePicker / Calendar component in a Zend_Form script like the script below, i want to use the datepicker in a Bug Report Form for selecting the date in the date_reported field when the bug is reported. The Zend_Form script that i have looks like this




<?php

class Form_BugReportForm extends CMS_Form
{
public function __construct($options = null)
{
parent::__construct($options);
$this->setName('BugReport');

// add element: date textbox
$date = new Zend_Form_Element_Text('date_reported');
$date->setLabel('Date the issue occurred (dd-mm-yyyy):')
->setRequired(true)
->addValidator(new Zend_Validate_Date('DD-MM-YYYY'))
->setAttrib('size', 20);

// add element: URL textbox
$url = new Zend_Form_Element_Text('url');
$url->setLabel('Issue URL:')
->setRequired(true)
->setAttrib('size', 50);

// add element: description text area
$editorOptions = new Zend_Config_Ini(APPLICATION_PATH . '/configs/tinymce.ini');
// add element: description text area
$description = new CMS_Form_Element_TinyMce('description', array(
'label' => 'Issue description:',
'required' => true,
'cols' => '80',
'rows' => '10',
'editorOptions' => $editorOptions->form->elements->body->options->editorOptions
));

// add element: priority select box
$priority = new Zend_Form_Element_Select('priority');
$priority->setLabel('Issue priority:')
->setRequired(true)
->addMultiOptions(array(
'low' =>'Low',
'med' =>'Medium',
'high' =>'High'
));

// add element: status select box
$status = new Zend_Form_Element_Select('status');
$status->setLabel('Current status:')
->setRequired(true)
->addMultiOptions(array(
'new' =>'New',
'in_progress' =>'In Progress',
'resolved' =>'Resolved'
));

// add element: submit button
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Submit');

$this->addElements(array($date, $url, $description, $priority, $status, $submit));

}
}