I have not yet seen any responses to this inquiry, which is perfectly fine
if no one has any advice to offer, but I want to make certain that my
inquiry actually made it to the list, so I am now sending this message via
Nabble. Many thanks!
notmessenger wrote:
>
> I know how to create individual Zend_Form objects and display them in my
> view, error check them, etc. Now what I am attempting to do though is
> have a form class that can be called via various methods and have
> different combinations of the form (output) be displayed.
>
> If I only assign the first call of $form->assignToExisting() to my view, I
> get one form with one text field with the value of 'Test Field 1' as
> expected. If I have both calls though, I get two forms (as expected) but
> both have the same field of 'Test Field 2'. Am I not using clearElements()
> like I think it should be used?
>
> Or is there a better way I should be approaching this?
>
> Thanks!!
>
>
> In my controller
> ----------------
>
> $form = new forms_exception_assignPartnerAliases();
>
> $this->view->form_assignToExisting = $form->assignToExisting();
> $this->view->form_createNew = $form->createNew();
>
>
> Form Class
> ----------
>
> class forms_exception_assignPartnerAliases extends Zend_Dojo_Form
> {
> private $_request;
>
> // Normally a definition here - saving space in this post
> protected $_elementDecorators = null;
>
> public function init()
> {
> // Get request object
> $this->_request =
> Zend_Controller_Front::getInstance()->getRequest();
>
> $this->setMethod( 'post' )
> ->setAction(
> '/manage/exception/assign/by/partner' )
> ->setName( 'assign' );
> }
>
> public function assignToExisting()
> {
> // Clear all previous elements since this
> form object is being used to display two different forms via shared code
> base
> $this->clearElements();
>
> $this->_addHiddenElements();
>
> $this->addElement(
> 'text',
> 'description',
> array(
>
> 'decorators' => $this->_elementDecorators,
> 'label'
>
> => 'Test Field 1',
> 'value'
>
> => 'test1',
> )
> );
>
> return $this;
> }
>
> public function createNew()
> {
> // Clear all previous elements since this
> form object is being used to display two different forms via shared code
> base
> $this->clearElements();
>
> $this->_addHiddenElements();
>
> $this->addElement(
> 'text',
> 'description',
> array(
>
> 'decorators' => $this->_elementDecorators,
> 'label'
>
> => 'Test Field 2',
> 'value'
>
> => 'test2',
> )
> );
>
> return $this;
> }
>
> private function _addHiddenElements()
> {
> $this->addElement(
> 'hidden',
> 'qualifier',
> array(
> 'value'
> => $this->_request->getParam('qualifier'),
> )
> );
> }
> }
>
>
> ----
> Jeremy Brown, ZCE
> Senior Web Developer
> Spear One
> 972.661.6038
> www.spearone.com<http://www.spearone.com>
>
>
>
> -----
> Jeremy Brown
> Senior Web Developer
> Spear One
> 972.661.6038
> www.spearone.com
>
-----
Jeremy Brown
Senior Web Developer
Spear One
972.661.6038
www.spearone.com
--
View this message in context:
http://www.nabble.com/Getting-Zend_%28Dojo%29_Form-to-output-variable-forms-tp20780654p21097307.html
Sent from the Zend Framework mailing list archive at Nabble.com.