Programmer man
Programmer man

Reputation: 393

zend link button element in controller

I have this button in my controller and trying to echo it back to the user in my view phtml but its seems not to be returning the element.

Button

    $button = new Zend_Form_Element_button('button');
    $button->setAttrib('id', 'B!');
    $button->setLabel('Previous');
    $button->setAttrib('onClick', "parent.location='" . Zend_Controller_Front::getInstance()->getBaseUrl() .'/../..' ."'");

$this->view->button = $button;

in my view

<?php echo $this->button; ?>

Upvotes: 2

Views: 235

Answers (1)

doydoy44
doydoy44

Reputation: 5772

Your code work in my application.

If you just want a button, you can do something like that:

In your Controller :

$this->view->location = "parent.location='" . Zend_Controller_Front::getInstance()->getBaseUrl() .'/../..' . "'";

In the view

<input id="B" type="button" value="Previous" onClick="<?php echo $this->location;?>">

Upvotes: 1

Related Questions