+ Reply to Thread
Results 1 to 3 of 3

Thread: Setting zend form view scripts

  1. #1
    nfrandsen is offline Junior Member
    Join Date
    Dec 2008
    Posts
    23

    Default Setting zend form view scripts

    Hey guys,
    I've got a multipage form using zend_form, but I am having some problems with figuring out how to designate a view script from inside the form.
    As its a multipage form using subforms, the are all controlled by the index action and thus using index.phtml.
    However i need to upload photos in the second page so I am wanting the second form to render images.phtml, how do I do this?
    I've tried various things inside zend_form such as:
    [PHP]
    public function init()
    {
    $view = new Zend_View();
    $view->addScriptPath(APPLICATION_PATH . '/modules/app/views/scripts/listing/');
    $view->render('process.phtml');

    $this->addElement('submit', 'btnNext', array( 'label' => 'Next'));

    }
    [/PHP]
    however it doesnt work, it simply continues to render index.phtml. Anyone have any suggestions?

  2. #2
    mark2331 is offline Senior Member
    Join Date
    Oct 2008
    Location
    Los Angeles, CA
    Posts
    109

    Default

    Set the view script inside the form by using loadDefaultDecorators().

    [PHP]
    public function init()
    {
    // add elements here
    }

    public function loadDefaultDecorators()
    {
    $this->setDecorators(array(
    array('ViewScript', array('viewScript' => 'process.phtml'))
    ));
    }
    [/PHP]

  3. #3
    nfrandsen is offline Junior Member
    Join Date
    Dec 2008
    Posts
    23

    Default

    cheers that worked!

+ Reply to Thread

Similar Threads

  1. Zend Form - Setting up the form with Multicheckbox
    By ranjuvs in forum Model-View-Controller (MVC)
    Replies: 2
    Last Post: 03-03-2010, 05:55 AM
  2. Handling view scripts
    By MeroeKush in forum Model-View-Controller (MVC)
    Replies: 0
    Last Post: 12-18-2009, 05:39 AM
  3. Zend_Form_Element_Captcha + View scripts
    By cmerlin in forum Authentication & Authorization
    Replies: 1
    Last Post: 12-17-2008, 08:35 AM
  4. Zend_Form view scripts
    By nfrandsen in forum Model-View-Controller (MVC)
    Replies: 2
    Last Post: 12-12-2008, 05:28 PM
  5. Actions are looking for view scripts
    By Captain Awesome in forum Model-View-Controller (MVC)
    Replies: 2
    Last Post: 07-20-2007, 11:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts