ZF-2735: Sending array to populate() sets all elements to null that aren't in array

Issue Type: Bug Created: 2008-02-26T13:42:42.000+0000 Last Updated: 2008-03-21T16:25:16.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Jason Eisenmenger (jasoneisen) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Form

Related issues: Attachments:


<pre class="highlight">
; general form metainformation
user.settings.action = "/user/settings"
user.settings.method = "post"

;formname element
user.settings.elements.formname.type = "hidden"
user.settings.elements.formname.options.value = "user_settings"

; username element
user.settings.elements.username.type = "text"
user.settings.elements.username.options.validators.alnum.validator = "alnum"
user.settings.elements.username.options.validators.regex.validator = "regex"
user.settings.elements.username.options.validators.regex.options.pattern = "/^[a-z]/i"
user.settings.elements.username.options.validators.strlen.validator = "StringLength"
user.settings.elements.username.options.validators.strlen.options.min = "6"
user.settings.elements.username.options.validators.strlen.options.max = "20"
user.settings.elements.username.options.required = true
user.settings.elements.username.options.filters.lower.filter = "StringToLower"

; password element
user.settings.elements.password.type = "password"
user.settings.elements.password.options.validators.strlen.validator = "StringLength"
user.settings.elements.password.options.validators.strlen.options.min = "6"
user.settings.elements.password.options.required = true

; submit element
user.settings.elements.submit.type = "submit"

<pre class="highlight">
$config = new Zend_Config_Ini('/path/to/config.ini', 'development')
$form = new Zend_Form($config);

$user_settings = array('username' => 'johndoe');


$this->view->login_form = $form;

The above would set to null all fields except username, including the hidden field which might be used in this example to figure out how to process the form.


Posted by Matthew Weier O'Phinney (matthew) on 2008-03-05T10:24:19.000+0000

Scheduling for 1.5.0 GA release.

Posted by Matthew Weier O'Phinney (matthew) on 2008-03-07T11:54:59.000+0000

Resolved in trunk and 1.5 release branch.

Posted by Ken Crane (kcrane377) on 2008-03-07T12:35:32.000+0000

I am still experiencing the issue with Form Images

When I populate a form my image src attrib is being set to null

Code below: [code] $image = new Zend_Form_Element_Image('submitImage'); $image->setLabel('') ->setValue('test.gif') ->setAttrib('class', 'button'); $form->addElement($image); [code] Outputs:

if ($this->_request->isPost()) { if ($form->isValid($this->_request->getPost())) { } else { $form->populate($this->_request->getPost()); } } [code] Outputs:

Posted by Ken Crane (kcrane377) on 2008-03-07T12:37:44.000+0000

Sorry about the formatting.

Here is the correct formatting:

I am still experiencing the issue with Form Images

When I populate a form my image src attrib is being set to null

Code below:

<pre class="highlight">
$image = new Zend_Form_Element_Image('submitImage');
->setAttrib('class', 'button');


<pre class="highlight">
if ($this->_request->isPost()) {
if ($form->isValid($this->_request->getPost())) {
} else { $form->populate($this->_request->getPost()); }


Posted by Matthew Weier O'Phinney (matthew) on 2008-03-07T12:50:04.000+0000

Ken -- what you are reporting is an unrelated issue that's specific to the image element and its decorators. I think I know what's happening, but please open a separate issue to report it.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.