zend-form

zend_form ViewScript decorator / passing arguments

I have a form that is extend from Zend_Form. I am placing the form into a ViewScript decorator like this: $this->setDecorators(array(array('ViewScript', array('viewScript' => 'game/forms/game-management.phtml')))); I'd like to pass in a variable to this ViewScript but am not sure how this could be done. Since the partial renders out...

How do I use ViewScripts on Zend_Form File Elements?

I am using this ViewScript for my standard form elements: <div class="field" id="field_<?php echo $this->element->getId(); ?>"> <?php if (0 < strlen($this->element->getLabel())) : ?> <?php echo $this->formLabel($this->element->getName(), $this->element->getLabel());?> <?php endif; ?> <span class="value"><?php echo $this->...

Change HTML output of Zend_Form

Hi, I'm trying to change the html outputted by Zend_Form using decorators. I want the outputted HTML to look like this: <form> <fieldset> <legend>Your Details</legend> <dl> <dt>label etc</dt> <dd>input etc</dd> <dt>label etc</dt> <dd>input etc</dd> </dl> </fieldset> <fieldset> <legend>Addre...

Override Separator on Zend_Form Radio Elements When Using a ViewScript Decorator

I am using ViewScripts to decorate my form elements. With radio elements, the separator can normally be overridden, but the override is being ignored when I use the ViewScript. When I use the below call and ViewScript, the radio elements are separated by a '<br />' rather than the space I've specified. If leave the default decorators,...

Zend Form Decoration Issues

I've got a few random issues with decorator related stuff with Zend Form. Firstly, // THIS WORKS AND REMOVES THE DECORATORS $hidden = new Zend_Form_Element_Hidden('hiddenfield'); $hidden->setRequired(TRUE) ->removeDecorator('label') ->removeDecorator('HtmlTag') ->addErrorMessage('Please upl...

How to set the id of an lement in Zend_Form manually?

Hello, I have an image element in my Zend_Form. $dropDownButton = new Zend_Form_Element_Image('image_button'); $dropDownButton->setOptions(array('image'=>'/images/image1.png', 'style'=>'padding-top:20px', ) ); $this->addElement($dropDownButt...

Can I use my normal (html) form in Zend Framework ?

Can I use my normal (html) form in Zend Framework ? How can I do that & How can I call action in IndexController file? ...

zend form decorators

Having (more) issues with zend form decorators. I've got this so far: Reset overall form decorator: $this->clearDecorators(); $this->setDecorators(array('FormElements', 'Form')); I'm adding all my elements to a display group that i want to be inside a fieldset, within a DL $group->setDecorators(array( 'FormEle...

How to create a checkbox tree filled from database using Zend_Form ?

How do I do that with Zend_Form? <ul> <?php foreach ($this->roles as $module => $resources): ?> <li> <?php echo $module; ?> <ul> <?php foreach ($resources as $resource => $privileges): ?> <li> <?php echo $resource; ?> <ul> <?php foreach ($pri...

How to have a preview component in zend form?

Hello,i want to add a preview component to my zend form. This preview component basically allows the user to construct a drop down and see how it looks (yes unfortunately that is a requirement). so im constructing this dropdown - and when the user clicks on 'add drop down' (a button present in that form) , the drop down has to be preview...

Custom View Helper is never run when extending Zend_Form_Element_File

Hi, I want my own form element based on Zend_Form_Element_File. My Problem: the custom view helper I created is never run. Instead, always the FormFile Viewhelper is run. When I inherit from Zend_Form_Element_Xhtml, my custom view helper works. Does not work: class XY_Model_Form_Imageu extends Zend_Form_Element_File { public $helper...

How to customize error output in Zend_Form for table layout.

I need to output the following form layout: <tr><td>Label</td><td>Element</td></tr> <tr><td></td><td>ElementErrors</td></tr> This is needed for the elements and labels to be centered vertically and errors should be with the same indentation as elements. Can I achieve this with the usage of decorators or maybe I need to change my mark...

How to combine two Zend_Forms into one Zend_Form?

I have two Zend_Forms (form1 and form2). I would like to combine them so I have a third form (form3) consisting of all the elements from both forms. What is the correct way to do this with the Zend Framework? ...

How to display 2 display groups in the same div in a zend form?

Hello, How can I display more than 1 display group WITHIN a div? I simply need to show a visual separation - but within the same div. Is there a way to show more than 1 display group within a div? for example: to achieve the following in zend forms: <div style="width: 100%;"> <div style="width: 50%; float: left; paddi...

Recommended Path For Zend Form Element View Scripts

I had started putting my form element view scripts under '/application/views/scripts/form/' and was able to reference them by 'form/scriptname.phtml', but now I need to make a 'form' controller and I realize this was a short-sighted solution. The examples I've seen use something like '/path/to/your/view/scripts/' which doesn't help me w...

Something wrong with values in submit buttons

$button = new Zend_Form_Element_Submit('melnraksts'); $button->setAttrib('id','melnraksts'); $button->setValue(Lang::$form[17]); $button->setDecorators(array('Composite')); $button->removeDecorator('Errors'); $form->addElement($button); $submit = new Zend_Form_Element_Submit('submit'); $submit->setA...

How to add CSS classes to Zend_Form_Element_Select option

Hi, I'm trying to add a CSS class to a Zend_Form_Element_Select option, but I just can't find a way to do it. The desired output would be something like this: <select name="hey" id="hey"> <option value="value1" style="parent">label1</option> <option value="value2" style="sibling">sublabel1</option> <option value="value3" s...

Problem with addDisplayGroup in the Zend Form

Hi all, I have a form same the following code: public function init(){ $id=$this->createElement('hidden','cf_id'); $id->setDecorators($this->elementDecorators); $id->setOrder(1); $this->addElement($id); $firstName=$this->createElement('text','firstName'); $firstName->setDecorators($this->elementDecorators); $firstName-...

How to disable individual options in a Zend_Form_Element_Radio

Is it possible to disable individual options in a Zend_Form_Element_Radio? That is, I'd like to add disabled="disabled" to certain input tags. Does the Zend Framework include this functionality? Or is there another way to accomplish this? ...

Date validator that validates if the date is greater than or equal to today with Zend Framework

$form = new Zend_Form(); $mockDate = new Zend_Form_Element_Text('mock'); $mockDate->addValidator(???????); $form->addElements(array($mockDate)); $result = $form->isValid(); if ($result) echo "YES!!!"; else echo "NO!!!"; Assumption that the element is in a date format. How do I determine that the date given is greater than or equal...