Think of $options as an associative array of key/value pairs, where each of the pairs is passed to a matching setter:
$form = new Zend_Form(array('foo' => 'bar')); // Equivalent to: $form = new Zend_Form(); $form->setFoo('bar'); Zend_Form first looks for a matching setter, but if none is found, it assumes the key/value pair is meant for the form attributes (which is what you saw in your test). The equivalent would be: $form = new Zend_Form(); $form->foo = 'bar'; The neat thing is if you extend Zend_Form, you can supply the missing "setFoo()" method: class MyForm extends Zend_Form { protected $_foo; public function setFoo($value) { $this->_foo = $value; } } $form = new MyForm(array('foo' => 'bar')); // Now truly equivalent to: $form = new MyForm(); $form->setFoo('bar'); And lastly you can add the complimentary getFoo() method to retrieve that value later: class MyForm extends Zend_Form { /* ... */ public function getFoo() { return $this->_foo; } } But with that said, this still won't help you in your case. The value of "foo" will disappear on the next request. You'll need to either use a hidden input (which can be spoofed by an evil user) or the session (much, much harder to spoof). I hope this helps! -- Hector On Tue, Jul 6, 2010 at 10:13 PM, ajmurray <ajmurra...@gmail.com> wrote: > > I have a simple question, playing with Zend_Form, I have created a form > passing variables when instansiating the class like so: > > $options['rval'] = 1; > $options['sval'] = 2; > $options['tval'] = 3; > $form = new Zend_Form($options); > > and I get something like this: > <form id="zend-form" rval="1" sval="2" tval="3" action="" method="post"> > </form> > > what I am wondering, is there a way to retrieve rval, sval, and tval in my > action controller? > > I have checked $request->getPost() and $request->getParams() and > $request->getUserParams(), but none of those contain the values. I know I > am mistaken on the usage of $options, but it would be very useful (allowing > me to avoid using input type hidden). Though I am presuming this is not > possible I thought I would ask anyhow. > > Thanks > Aaron > -- > View this message in context: > http://zend-framework-community.634137.n4.nabble.com/Zend-Form-question-tp2280478p2280478.html > Sent from the Zend Framework mailing list archive at Nabble.com. >