zend-form

XML configuration of Zend_Form: child nodes and attributes not always equal?

A set of forms (using Zend_Form) that I have been working on were causing me some headaches trying to figure out what was wrong with my XML configuration, as I kept getting unexpected HTML output for a particular INPUT element. It was supposed to be getting a default value, but nothing appeared. It appears that the following 2 pieces of...

Hidden checkbox in zend

Hello How can I make hidden multi checkbox in zend form? ...

Adding a class to the $tag surrounding a <label> in a Zend_Form with the Label decorator

I'm trying to get the following html out of Zend_Form <div class="group wat-cf"> <div class="left"> <label class="label right">Username</label> </div> <div class="right"> <input type="text" class="text_field"> </div> </div> Using the following code: $username->setAttrib("class", "text_field") ->setDecorators(...

How can I add multiple divs or fieldsets to a zend_form using decorators?

I'm trying to generate this html heirarchy in my zend_form display group: <div class="settings"> <div class="dashed-outline"> //want to add this div <fieldset disabledefaultdecorators="1" id="fieldset-settings"> <legend>Cards</legend> </fieldset> </div> </div> This is what I have cur...

zend_form display group inside foreach

I want to create a display group generated from foreach() clause output. I can't seem to get the syntax correct. Here's the business logic: for each category row find the associated fees output the category description as a label and the fees as radio buttons then create a display group with the fees as the group elements and the cat...

How can I set the class for a <dt> element in a Zend_Form?

I'm trying to set the width of the style for a group of < dt > elements in a Zend_Form. Is there a way to set a class for a dt element, so the end result would be something like this: <dt id="name-label" class="xyz" > // trying to add the 'class="xyz" <label class="required" for="name">Name:</label> </dt> <dd id=...

Zend_Dojo_Form not rendering in layout

Hi, I have a quick question about adding Zend_Dojo_Form into Zend_layouts. I have a Zend_Dojo_Form that I want to display in the layout that is used for a particular controller. I can add the form to the layout without any issue however the dojo elements fail to render, as they would do if I added the form to a standard view. Is th...

Setting the inner html text of a < span > element using Zend_Form_Decorators

I'm trying to set the inner html of the < span > tag here , so it looks like: Group this is what i have so far: $form->addDisplayGroup( array( ................ ), 'maingroup1', array( 'legend'=>'', 'disa...

What is the proper syntax for describing a <SELECT> form element to Zend_Form using XML as the config?

I am using an XML config file to tell Zend_Form what elements I want. I would like to have a <select> element, but I am unsure as to how to add <option> tags using the XML syntax. Sure I am missing something pretty basic. Ben ...

How to avoid saving escape character (\) in db

I'm using zend frame work zend form and zend db for my project. The problem I have is, when the user enter some special characters in the text field (i.e "I'm"), it is saved in the database with the "\" character (i.e. "I\'"). I need to know how to fix this so it just saved as whatever the user entered. ...

Zend file upload error

I am attempting to upload a file using Zend Framework 1.8 and I get some errors. Here is the code snippet: The form element: $element = new Zend_Form_Element_File('doc'); $element->setLabel('Upload an image:') ->setDestination('/path/to/my/upload/folder'); $element->addValidator('Count', false, 1); $element->addValidator('Si...

Zend_Form Decorations Issue with Description and Errors

Hi all. I've spend all the day trying to set the Zend_Form decorators for the following format: <dt> <label for="square_meters">The label</label> </dt> <dd> <input type="text" name="square_meters" id="square_meters" /> <div class="description-div">m2</div> </dd> I got it. Currently this is working with the following array: $des...

zend framework error

I started getting the following error today, but don't know why and what caused it. [31-May-2010 03:52:10] PHP Fatal error: Cannot run code from this file in conjunction with non encoded files in ZendFramework-1.10.5/library/Zend/Validate/Hostname/Com.php on line 547 I'm using zend framework version 1.10.5; although version 1.09 also ...

Zend_Form: Is this really the way we should be doing things?

OK. I understand how to use Zend_Form and it's implementation of the decorator pattern. My question is, is this the best way to be going about creating forms? Shouldn't a documents forms be left to to the front-end rather than generating forms programmatically? Doesn't this kinda violate the whole idea of keeping things separate? I mea...

How to populate() an entire Zend_Form minus one form element?

I have a simple content edit form (Zend_Form) that I populate() with an array generated from the Zend_Db_Table_Row_Abstract->toArray() method. It works quite well. The goal is to not populate one of the form elements with a value. I'm currently solving this by removing that specific key => value pair from the populating array. I'm curi...

Zend Form - how do I create these custom form elements?

This is a very specific instance where I'm having difficulty getting Zend Form to produce the correct output and supply the correct validation. I may have to go create a composite element but thought I'd ask here first. Here is the HTML I'm trying to get Zend Form to produce. I'd like this to be able to work where if the validation doesn...

Zend Form not in place labbels values, how to move them that they will be exactly above text box?

Hi, I have esthetic's problem. Zend Form not in place label value, how to move them that they will be exactly above text box, and not from left? (I didn't put filters and validation to make this code simpler here) My Code Login.php form: public function init() { $username = new Zend_Form_Element_Text('username'); $username->setLab...

How to present a select type(drop down) in a tree view format in Zend_Form

Hello everyone, I am doing a new project in Zend and it needs a drop down which populates y the data from database (i.e Categories).I need to show those categories Data to be shown in the form of Tree view in the Drop Down menu.I have tried a bit doing it by just fetching the data from the database and then arranging them into the ZEND_F...

Zend Framework: How to start PHPUnit testing Forms?

I am having trouble getting my filters/validators to work correctly on my form, so I want to create a Unit test to verify that the data I am submitting to my form is being filtered and validated correctly. I started by auto-generating a PHPUnit test in Zend Studio, which gives me this: <?php require_once 'PHPUnit/Framework/TestCase.php...

Zend Form: How to pass parameters into the constructor?

I'm trying to test my form. It will be constructing other objects, so I need a way to mock them. I tried passing them into the constructor... class Form_Event extends Zend_Form { public function __construct($options = null, $regionMapper = null) { $this->_regionMapper = $regionMapper; parent::__construct($options...