zend-form

Zend_Form arbitrary number of key-value pair fields

I'm trying to create a form using Zend_Form (Zend_Framework component). The users should be able to add arbitrary number of fields. Just as you can upload files with gmail GUI. Example: [_____] [+] After clicking on the [+] button: [_____] [_____] [+] To get things complicated, I'd like to add field pairs, so it would look like thi...

Zend_Form: How to add an element to the DD tag of another element?

So, what I would like to do is take one form element and add it to another one: <!-- original --> <dl class="zend_form"> <dt>label</dt> <dd><input id="1"></dd> <dt>label</dt> <dd><input id="2"></dd> </dl> <!-- desired outcome --> <dl class="zend_form"> <dt>label</dt> <dd> <input id="1"> <input i...

Zend Form: How to set the length of a text input or textarea element?

By default Zend Form Text elements don't have a width specified. Textarea elements have a default of rows="24" and cols="80". But when I set a different value... $body = new Zend_Form_Element_Textarea('body'); $body->setLabel('Body:') ->setRequired(true) ->setAttrib('COLS', '40') ->setAttrib('ROWS', '4'); $this->addElement($...

Do Not Escape setAttrib() Method (Zend_Form)

I would like to add an attribute to some form elements in the action controller, I can do it like this: $form->element_name->setAttrib('description', '<a href="/controller/action">Anchor</a>'); However in the above example the second argument gets escaped. I would like to have it unescaped. How can I do that? ...

Showing a manually-set error in Zend_Form

When a visitor enters their email address into a form, I want to check that it's unique. So I have a simple email form: class Form_Register extends Zend_Form { public function __construct($options = null) { parent::__construct($options); $this->setName('register'); $email = new Zend_Form_Element_Text('Email'); $email->s...

Is there an easy way to disable Zend_Form errors?

I am using Zend Framework. For a particular form, there is not enough space to show the errors next to the form elements. Instead, I want to be able to display the errors above the form. I imagine I can accomplish this by passing $form->getErrorMessages() to the view but how do I disable error messages from being shown be each element...

Remove Element Description In Controller (Zend_Form)

I would like to edit an element description in the action controller. I'm trying to do it like this: $form->element->setAttrib('description', ''); But it doesn't work. Any ideas? ...

Problem retrieving values from Zend_Form_SubForms - no values returned

I have a Zend_Form that has 4 or more subforms. /** Code Snippet **/ $bigForm = new Zend_Form(); $littleForm1 = new Form_LittleForm1(); $littleForm1->setMethod('post'); $littleForm2 = new Form_LittleForm2(); $littleForm2->setMethod('post'); $bigForm->addSubForm($littleForm1,'littleForm1',0); $bigForm->...

PHP Zend doesn't display correctly

I am trying to recreate the following blog's tabbed forms for my website. http://zendguru.wordpress.com/2009/01/15/zend-framework-and-dojo-creating-tabbed-form/ I currently have the form displaying on my page, however instead of tabs it displays the whole form like normal. I know that the form is displaying the subforms as I have com...

solved: zend_form access parent form element

Ok, I think I did my due diligence here. I couldn't find any reference on how to use a parent form element in a subclassed form. May be because it's obvious to everyone but me. It's got me stumped. This is what I tried. At first, within my form constructor I called parent::__construct($options = null); then accessed the parent elemen...

How to create an AJAXified form within the Zend Framework

I'm trying to create a contact form. However at the top of the form the user can select using radio buttons whether he's contacting the technical department or the marketing department. Depending on which he selects, the entire form changes. How would this be implemented within the Zend Framework? I'm already extending Zend_Form to mak...

Zend form and Zend filter HtmlEntities

Hi. I have a registration form with a few fields. One of them looks like this: $first_name = new Zend_Form_Element_Text('first_name'); $first_name ->setLabel("First name") ->setRequired(true) ->addFilter(new Zend_Filter_HtmlEntities()); I use the same form for editing user's deta...

Default element value using Zend_Form with Zend_Config_Ini

I have been looking for hours and I can't find any documentation anywhere as to how you set the default value of an element using Zend_Config_Ini as the initialisation to a Zend_Form. I've seen the documentation for how you do it in normal PHP code... $validators = array( 'month' => array( 'digits', 'default' => '1'...

Add HTML placeholder into Zend_Form

I'm using Zend_Form for an application form using this code: class Form_ApplicationForm extends Zend_Form { public function init() { $this->setAction('/application/new') ->setMethod('post') ->setAttrib('id','application'); $name = new Zend_Form_Element_Text('name'); $name->setLa...

creating a custom form element in Zend_Form

I'm attempting to create a custom form field in Zend_Form to store a snippet of HTML that is required by SWFUpload(for the purposes of a flash file uploader). I've tried following a few different tutorials but i'm getting pretty confused, so far this is what i have: /application/forms/elements/SwfUpload.php ...

Zend_Form : Adding fields in sub-forms on user's click

I'm having a zend form - comprised of a number of zend - sub forms, where the user is creating a new question (its a content management system). In one of the subforms, the user can click on a button to add more textfields, like this: [----------] [----------] [click to add more] which should give [----------] [----------] [---------...

Zend_Form filters rewrite or route - I want a readable URL

I have a form created with Zend_Form and I would like to setup a Route for the submission, so that instead of the user NOT seeing his URL change OR seeing the URL change to a complicated GET string, it will change to reflect the filters. BAD: /products BAD: /products?color=white&size=large GOOD: /products/white/large GOOD: /products/...

HTML snippet within Zend_Form

I'm using Zend_Form as part of a simple signup process. In part 1 of 2 the user is able to upload a number of images. In part 2 - for each one of these images - I ask the user to add further details - an additional 4 text fields grouped together using addDisplayGroup. Within each display group I want to display a thumbnail of the uploade...

Setting decorators to Zend_Form_Element_Checkbox

I have a zend form comprised of 4 subforms. 1 of these subforms has 4 elements, and one of those elements is a zend_form_element_checkbox. I have 4 different display groups (1 for each subform) - one is : 'billing address', one is 'credit card info' , 'notifications' and 'misc' Assuming that 'notifications' is the part that has the chec...

Zend Form decorators trouble

How do I achieve the following with form decorators for form elements: <dt> <ul> <li>The errors</li> <li>The errors</li> </ul> <label>The label</label> </dt> <dd> <input type="text" value="The input field"> </dd> In other words, in stead of Errors appended after the input field, I want them prepended before the Label. ...