-- gammamatrix <[EMAIL PROTECTED]> wrote
(on Saturday, 01 March 2008, 02:34 AM -0800):
> 
> After reviewing some code... I see this in the doc blocks:
> 
>  * Any options passed will be used as HTML attributes of the fieldset tag of
> Zend_Form_Decorator_Fieldset

The form action and method are stored in their internal attribs array,
which is passed to the fieldset decorator and used to create the HTML
attributes. We could potentially remove the action and method attributes
within the fieldset decorator before passing them to the fieldset view
helper.

The question is: should we? They won't cause issues with the fieldset,
but they *do* potentially expose more information than you might want.

What do others think?


> gammamatrix wrote:
> > 
> > I have not finished debugging this issue...
> > 
> > I saw no issues in JIRA...
> > 
> > Below is my generated form. As you can see, the fieldset is incorrect.
> > there should not be an action or a method parameter. In the bottom of this
> > post is an INI file. If the last three lines are commented out as:
> > 
> > ;form.decorators.elements.decorator = "FormElements"
> > ;form.decorators.fieldset.decorator = "FieldSet"
> > ;form.decorators.form.decorator = "Form"
> > 
> > Then this broken fieldset tag does not appear.
> > 
> > <fieldset id="" action="/index/index/login/" method="post"><legend>My
> > Legend!</legend>
> > 
> > <!-- Start Form -->
> > 
> > <form enctype="application/x-www-form-urlencoded"
> > action="/index/index/login/" method="post"><fieldset id=""
> > action="/index/index/login/" method="post"><legend>My Legend!</legend>
> > 
> > <fieldset id="login">
> > <dt><label for="username" class="required">Username</label></dt>
> > <dd>
> > <input type="text" name="username" id="username" value="" /></dd>
> > <dt><label for="password" class="required">Password</label></dt>
> > <dd>
> > <input type="password" name="password" id="password" value=""
> > /></dd></fieldset>
> > 
> > <dt></dt>
> > <dd>
> > <input type="hidden" name="fid" value="4e77f48df2e9710c6426b69ea882b143"
> > id="fid" /></dd>
> > <dt></dt><dd>
> > <input type="submit" name="Login" id="Login" value="Login" /></dd>
> > <dt></dt><dd>
> > <input type="submit" name="Cancel" id="Cancel" value="Cancel"
> > /></dd></fieldset></form>
> > <!-- End Form -->
> > 
> > Code:
> > 
> > <?php
> > 
> >     public function getForm() 
> >     {
> > 
> >             $file = BASE_MODULES . DS . $this->view->m . DS . 'views/forms' 
> > . DS .
> > $this->view->c . DS . $this->view->a . '.ini';
> >             if(!is_file($file)) {
> >                     throw new Exception('Not a file: ' . $file . PN . 
> > __CLASS__ . PN .
> > __FUNCTION__);
> >             }
> >             
> >             $this->view->form = new Zend_Form();
> > 
> >             $this->view->form->setAction(DS . $this->view->m . DS . 
> > $this->view->c .
> > DS . $this->view->a . DS);
> > 
> >             $this->view->form->setMethod('post');
> >             
> >             $config = new Zend_Config_Ini($file, VIEW);
> > 
> >             $this->view->form->setConfig($config->form);
> > 
> >             $this->view->form->addElement('hash', 'fid', array('salt' =>
> > 'FID_SALT'));
> >             
> >             $this->view->form->addElement(new 
> > Zend_Form_Element_Submit('Login'));
> >             $this->view->form->addElement(new 
> > Zend_Form_Element_Submit('Cancel'));
> > 
> >     }
> > 
> > ?>
> > 
> > 
> > # INI file
> > 
> > [A]
> > 
> > ; username element
> > form.legend = "My Legend!"
> > form.elements.username.type = "text"
> > form.elements.username.options.label = "Username"
> > form.elements.username.options.validators.alnum.validator = "alnum"
> > form.elements.username.options.validators.regex.validator = "regex"
> > form.elements.username.options.validators.regex.options.pattern =
> > "/^[a-z]/i"
> > form.elements.username.options.validators.strlen.validator =
> > "StringLength"
> > form.elements.username.options.validators.strlen.options.min = "6"
> > form.elements.username.options.validators.strlen.options.max = "20"
> > form.elements.username.options.required = true
> > form.elements.username.options.filters.lower.filter = "StringToLower"
> > 
> > ; password element
> > form.elements.password.type = "password"
> > form.elements.password.options.label = "Password"
> > form.elements.password.options.validators.strlen.validator =
> > "StringLength"
> > form.elements.password.options.validators.strlen.options.min = "6"
> > form.elements.password.options.required = true
> > 
> > ; submit element
> > ;form.elements.submit.type = "submit"
> > 
> > 
> > form.displayGroups.login.elements.username = "username"
> > form.displayGroups.login.elements.password = "password"
> > form.displayGroupDecorators.elements.decorator = "FormElements"
> > form.displayGroupDecorators.fieldset.decorator = "Fieldset"
> > 
> > form.decorators.elements.decorator = "FormElements"
> > form.decorators.fieldset.decorator = "FieldSet"
> > form.decorators.form.decorator = "Form"
> > 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Zend_Form-bug-with-fieldset-tag-tp15769017s16154p15773109.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to