ZF-12473: When we refer a form element by its name in the view using getElement() method it throws an error due to incorrect letter case.

Issue Type: Bug Created: 2012-11-22T07:36:14.000+0000 Last Updated: 2012-11-22T16:11:46.000+0000 Status: Closed Fix version(s): Reporter: Jay Bhatt (jayb) Assignee: Frank Br├╝ckner (frosch) Tags: - Zend_Form

  • zend-form-element

Related issues: Attachments:


If this is a form element,

$checkInDate = $this->createElement("text", "check-in-date"); $checkInDate->setAttrib("id", "check-in-date") ->setAttrib("class", "date-icon") ->setLabel("Arrival Date") ->setRequired(true) ->addValidator("NotEmpty", true, 'This field is required') ->addFilter('HtmlEntities') ->addFilter('StringTrim');

Referring this element by its name like below throws an error,

I.e. $form->getElement('checkInDate');

But below works fine.


When we create an element Zend_Form stores them in an array, but it seems that the array indexes in which these elements are stored are lower cased and the getElement() method will only work if an argument is passed in lower case (It won't work with uppercase and camel notation).


Posted by Jay Bhatt (jayb) on 2012-11-22T07:43:45.000+0000


Please ignore this. I figured out what the problem was and this is not a bug.

Regards, Jay

Have you found an issue?

See the Overview section for more details.


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

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