I'm pretty new to Zend Framework thou i am starting to get the gist of it, however i have once more run into a problem. I want to create a form where it is possible for the user to upload files.
Now the idea is that when the user first visits the page with the form, he/she will see only one form element with wich to upload a file and below that a button to add an additional file and thus an additional element to the form.
I have been looking around and have been suggested to try using JQuery, at this point it is probably good to mention i have never used JQuery, let alone in combination with the Zend Framework.
I have added the ZendX library to the same folder i have the Zend folder in, like this
/Zend Framework
/library
/Zend
/ZendX
I of course have the library folder included in my include_path variable in the php.ini . According to what i can make of the Zend Refference guide i need to add the following to my Bootstrap.
public function _initJQuery() {
$view = new Zend_View();
$view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper");
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
}
Having done that i build the following Jquery form in my content module.
<?php
class Content_Form_JQueryForm extends ZendX_JQuery_Form
{
public function init()
{
$this->setMethod('post');
$this->setName('frm');
$this->setAction('content/index/add');
$date1 = new ZendX_JQuery_Form_Element_DatePicker(
'date1',
array('label' => 'Date:')
);
$this->addElement($date1);
$elem = new ZendX_JQuery_Form_Element_Spinner(
"spinner1",
array('label' => 'Spinner:')
);
$elem->setJQueryParams(array('min' => 0, 'max' => 1000, 'start' => 100));
$this->addElement($elem);
}
}
Then in the controller i simply create the form and assign it to a view
public function indexAction() {
$form = new Content_Form_JQueryForm();
$this->view->form = $form;
}
And of course in the appropriate view i echo the form
<?php echo $this->form; ?>
And when i run the application i get the following error message
Fatal error: Class 'Content_Form_JQueryForm' not found in C:\wamp\www\ZendProject\application\modules\content\controllers\CategoryController.php on line 10
I am clueless as to what i have done wrong and if anyone could help me out it would really be appreciated.