2008年9月18日星期四

Re: [fw-mvc] ViewScript Form decorator script path.

This works in my setup:
$this->setDecorators(array(array('viewScript', array('viewScript' =>
'users/form.phtml'))));

view script location:
views/scripts/users/form.phtml

Is it possible to avoid nesting of arrays in the Zend_Form element
methods?
It really clutters the code up.

On 18 Sep 2008, at 08:26, Емил Иванов / Emil Ivanov wrote:

> class X_Form_Signup extends Zend_Form
> {
> public function __construct()
> {
> parent::__construct();
>
> ->addElement('text', 'username', array (
> 'required' => true
> ))
> ->addElement('password', 'password', array (
> 'required' => true
> ))
> ->addElement('password', 'repeatPassword', array (
> 'required' => true
> ))
>
> ->setDecorators(array (
> 'ViewScript' => array ('script' => 'signup.phtml')
> ))
> ;
>
> }
> }
>
> Here is it.
>
> Where should I put the signup.phtml file?
>
> 2008/9/17 enportugal <boas2@sapo.pt>
>
> Hi Emil Ivanov,
>
> Please post the form code, so we can take a better lok,
>
>
> Regards,
>
>
> Emil Ivanov wrote:
> >
> > Hi,
> >
> > After significant amount of suffering and struggling to get
> ViewScript
> > form
> > decorator to work I gave up. :)
> >
> > Where the views should be placed?
> >
> > The message that I get from the exception is not very useful.
> >
> > Here is the stack trace.
> >
> > Plugin by name Signup was not found in the registry.
> > #0 /home/emo/workspaces/softtech/cpays/lib/Zend/Form.php(1973):
> > Zend_Loader_PluginLoader->load('signup')
> > #1 /home/emo/workspaces/softtech/cpays/lib/Zend/Form.php(1996):
> > Zend_Form->_getDecorator('signup', NULL)
> > #2 /home/emo/workspaces/softtech/cpays/lib/Zend/Form.php(2052):
> > Zend_Form->addDecorator('signup', NULL)
> > #3 /home/emo/workspaces/softtech/cpays/lib/Zend/Form.php(2074):
> > Zend_Form->addDecorators(Array)
> > #4
> > /home/emo/workspaces/softtech/cpays/app/default/model/form/
> Signup.php(26):
> > Zend_Form->setDecorators(Array)
> > #5
> > /home/emo/workspaces/softtech/cpays/app/default/controllers/
> SignupController.php(6):
> > Afn_Form_Signup->__construct()
> > #6
> > /home/emo/workspaces/softtech/cpays/lib/Zend/Controller/
> Action.php(502):
> > SignupController->indexAction()
> > #7
> > /home/emo/workspaces/softtech/cpays/lib/Zend/Controller/Dispatcher/
> Standard.php(293):
> > Zend_Controller_Action->dispatch('indexAction')
> > #8 /home/emo/workspaces/softtech/cpays/lib/Zend/Controller/
> Front.php(914):
> > Zend_Controller_Dispatcher_Standard-
> >dispatch(Object(Zend_Controller_Request_Http),
> > Object(Zend_Controller_Response_Http))
> > #9 /home/emo/workspaces/softtech/cpays/html/index.php(73):
> > Zend_Controller_Front->dispatch()
> > #10 {main}
> >
> > Regards,
> > Emil Ivanov
> >
> > --
> > My place to share my ideas:
> > http://vladev.blogspot.com
> >
> > http://carutoo.com
> >
> >
>
> --
> View this message in context: http://www.nabble.com/ViewScript-Form-decorator-script-path.-tp19532828p19536129.html
> Sent from the Zend MVC mailing list archive at Nabble.com.
>
>
>
>
> --
> My place to share my ideas:
> http://vladev.blogspot.com

没有评论: