zend-form

Removing decorators on Zend form elements by parameters

Zend automatically adds tags around form elements it has generated. How may I remove these tags as paramaters to the addElement function. I have tried changing the disableLoadDefaultDecorators flag, however the element does not render at all then. For example: $searchForm->addElement('text', 'searchText', array('class'=>'onClickClear'...

How do you Unit Test a Zend_Form that includes the CSRF form element?

I'm using the CSRF hidden hash element with Zend_Form and trying to Unit Test the login but don't know how to write a Unit Test to include that element. Looked in the docs and read as many tutorials as I could find. I even delicioused them all, but no one mentions this. ...

How to validate >1 field at a time, in a Zend sub-form?

I've created a 3 screen "wizard" using the Zend_Form_SubForm example from the online reference documentation. The requirement I'm having trouble meeting is this: If fields 1, 2, & 3 of the first screen are already in the database, notify the user that they are trying to add a duplicate record. Each of those fields has their own validato...

Zend Form addFilter StripTags not stripping tags

Hi, I need a little help clearing something up with Zend_Form and adding filters to an element. Now I was under the impression that when you add a filter to the form that, when the form is posted that filter was executed as part of dispatch in the controller. However when testing my form to my horror the filter StripTags doesn't seem ...

What's the max JSON data size that can be loaded by Dojo ComboBox/Filtering Select Component?

Hi, I'm developing a form using the Zend Framework and utilising dojo. One part of the form is gathering a users contact details and address. The issue I am hitting is using the FilteringSelect or ComboBox dojo component to select the city/town. I have in my database a list of 40K+ town/city names. I've tried to use the Dojo compone...

Zend Framework Checkbox Decorators

What I am trying to accomplish is to have checkbox labels display after checkbox input fields (to the right of them). I am using these decorators now: private $checkboxDecorators = array( Label, array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'checkbox')), 'ViewHelper', array(array('row' => 'HtmlTag')...

Display Zend_Form_Element_Radio on one line

The radio buttons in Zend Framework are displayed in a column (one option per line). How can I remove the br tag from the markup so that all radio options stay in one line? My decorators are: private $radioDecorators = array( 'Label', 'ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'radio'))...

Zend_Form - multiple forms on same page

Having multiple forms in one page, when i submit one of them, how can i tell wich one was submitted? I thought about generating uniqe ids for each from, and saving them as hidden fields and to the user-session - while this is a solution, the problem with it is that there is no good place to remove old ids from the session. Any better i...

setting a default value in a dojo filteringselect

Hi, I'm trying to get a filtering select work with a Dojo enabled form using the Zend Framework. The form allows the user to update their details such as address, urls etc for their profile. However elements in the form are using a filiteringselect for things such as country and state/county. I want to get this to default with the va...

How do i remove the label decorator from a submit button

In my form i have this code; // Add the submit button $element = $this->addElement('submit', 'submit', array( 'ignore' => true, 'label' => 'Add new material' )); $element->removeDecorator('label'); However the form still renders with the label element between the tags. What am i doing wrong? ...

Geting error Connection Interrupted In Zend Framework

Hi I created one form with css and HTML without using Zend_Form and decorator. But with same element name created a form structure in my forms folder. and creating instance and using isValid function I am able to work with that form. Every thing works fine for last couple of days but today i am geting this error. The connection to th...

Zend Framework: Insert DIV and Image in my form

I need to insert html code like this in my zend form: <div class="myClass1" id="myId1" style="display: none;"><img src="images/myImage.jpg" /></div> What will be the code in zend framework for above html code. I tried with Create_Element but it always create a button inside a div tag. Please give an example code. Thanks ...

In a Zend_Form, how to avoid Zend_Validate_Email from generating multiple errors?

I am building a ZendFramework application which as a login form asking for an email address and password - it seemed to make sense to validate the email address before hitting the database with the login attempt, as an invalid email would never lead to a valid hit. Zend_Validate_EmailAddress seemed like the right way to go, but I am havi...

Zend Framework forms, decorators and validation: should I go back to plain HTML?

I am currently working on a pretty large application which contains a lot of forms. Up to this moment, I have always been writing my forms by hand and writing my own validation logic, but I have decided it was about time I started using Zend_Form and it's built-in validation routines. However, I keep stumbling upon more and more proble...

Is it possible to have complete control over zend_form layout?

I've been working with Zend Framework for a couple weeks so this might be a complete noobie question but I'm wondering if there's a way to customize the layout of forms in an explicit way using Zend_Form. I've looked all over the place but every example of Zen-Form I've found use the echo example. For example, when I work with Smarty an...

Populate date in MultiOptions element of Zend Form.

Hello I have an array like this : Array ( [id] => 1 [code] => Dep98 [description] => Hello World [facility] => Array ( [0] => FacName1 [1] => FacName2 ) ) But when I populate this array to Zend_Form it only show data in textboxes elements having same id as defined in array index not in multiselect dropdown elem...

Zend_Form Display Groups Problem

Here is a short snippet from my class extending Zend_Form: $this->addElements(array( $inputField1, $inputField2, $inputField3, $submitButton )); $this->addDisplayGroup(array('inputField1', 'inputField2', 'inputField3', 'submitButton')...

Access custom error messages for InArray validator when using Zend_Form_Element_Select

Hello, I'm using Zend Framework 1.62 (becuase we are deploying the finished product to a Red Hat instance, which doesn't have a hgih enough PHP version to support > ZF1.62). When creating a Form using Zend Form, I add a select element, add some multi options. I use the Zend Form as an in-object validation layer, passing an objects val...

Zend_Form and dojo FilteringSelect failing to populate

Hi, I am really struggling with the FilteringSelect component in this particular form. Now I have used this component before however for some reason this one just won't populate. I am using the Zend_Form and the form code for the filteringselect looks like this. $universities = new Zend_Dojo_Form_Element_FilteringSelect('university...

Zend Framework Form Irrational Behaviour

Let's start this off with a short code snippet I will use to demonstrate my opinion: $title = new Zend_Form_Element_Text('title', array( 'label' => 'Title', 'required' => false, 'filters' => array( 'StringTrim', 'HtmlEntities' ), 'validators' => array( array('StringLength', false, array(3, 100...