set form action in zf

Aug 28, 2011   //   by kdecom   //   zend framewok 2, ZEND FRAMEWORK, zf2  //  No Comments
Today i got a problem in setting up the zf form action url.

finally i found a simple way of adding it.

Inside your Form Classs For example in my case it was.

class Admin_Forms_AddProjectType extends Kdecom_Form {

    public function __construct($options = null) {
        parent::__construct($options);

        $this->setName(‘AddProjectType’);
        $projectTypeName = $this->CreateElement(‘text’, ‘project-type-name’)
                        ->setLabel(‘Project Type Name:’)->setAttrib(‘class’, ‘projectTypeName’);

        $submit = $this->CreateElement(‘submit’, ‘submit’)->setLabel(‘Save’);
        $this->setAction(“/kdstep/public/admin/project-type/add-project-type”);
        $this->addElements(array($projectTypeName,$submit));
      
      }

}

 I hope that helps.

Leave a comment

css.php