1) I can go to the form, but I can't put any data in it. I solved this (in a brute force and ignorace way) by doing: $this->getHelper('redirector')->gotoSimple('edit', 'Extensions', null,
array ('number' => $number));
2) I would like to use a FlashMessenger to pass messages to the user, but I can't get it to work. I suspect I'm sending the FlashMessenger messages to the wrong form...
Thank,
GTG
PS Sorry for top posting. C**p web e-mail client.
________________________________________
From: Matthew Weier O'Phinney [matthew@zend.com]
Sent: 03 August 2008 15:05
To: fw-mvc@lists.zend.com
Subject: Re: [fw-mvc] Multiple forms for one
-- Gordon Ross <gr306@ucs.cam.ac.uk> wrote
(on Sunday, 03 August 2008, 10:06 AM +0100):
> I've got a simple setup working in Zend fine (quite easy, really)
> However, I now want to do something a bit more complex.
>
> What I want to be able to do, is have different forms for different
> actions. However, the examples I've seen so far all seem to use one
> form for the different actions i.e. all the
> application/views/scripts/BLAH/xxx.phtml files all have the same
> "<?php echo $this->form ;?>" code.
>
> Can someone point me to some documentation, tutorials or examples ?
> I've tried searching but I'm not quite sure what to call this setup so
> I can't find anything relevant.
There's nothing magical or difficult about it. In your action, you
simply define or load the form you want, and pass it to the view;
typically you simply use the variable 'form', but it can be _anything_
you want. On the view script side, it will simply take the value
provided and render it -- the view script doesn't really know anything
about the variables, just that they exist.
As some examples:
public function fooAction()
{
$this->view->form = new My_Form_Foo();
/*
* View script will call:
* <?php echo $this->form ?>
*/
}
public function barAction()
{
$this->view->form = new My_Form_Bar();
/*
* View script will call:
* <?php echo $this->form ?>
*/
}
public function fooBarAction()
{
$this->view->fooForm = new My_Form_Foo();
$this->view->barForm = new My_Form_Bar();
/*
* View script will call:
* <?php echo $this->fooForm ?>
* <?php echo $this->barForm ?>
*/
}
Of course, you'll also need to setup actions for handling each form,
which means you should likely pass an 'action' option when instantiating
each form so that the appropriate action is called.
--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论