zend-form-element

How do configure Zend_Form to use array notation?

I'm having difficulty configuring Zend_Form. I have a Zend_Form sub-class. The form has some required information and some additional information. I want the additional information to be accessible via an array. The submitted data will look something like this: $formData['required1'] $formData['required2'] $formData['addiotnalData']['aD...

Zend Form: Checkbox element displays as hidden field?

I would like to add a simple check box to my form: $element = new Zend_Form_Element_Checkbox('dont'); $element->setDescription('Check this box if you don\'t want to do this action.'); $form->addElement($element); However, this is what the html looks like: <dt id="dont-label">&nbsp;</dt> <dd id="dont-element"> <input type="hidden"...

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'...

How can I dynamically add a Zend_Dojo form element to a zend_form?

Currently I can add a Zend Form element dynamically to a form after it is first loaded. I do this through a mouse click and some ajax. However, I want to add the exact same element with a different name (basically I am giving each element an id). However, when I add the field it just shows up like a normal field and isn't Dojo'fied. ...

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->...

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,...

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...

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...

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...

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...

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? ...

I am using an INI file format to create a Zend Form but I cannot seem to get the options array filled in from the ini.

Is there a way I can get my the following function ported correctly to the the Zend_Form_Element? I have a custom element and i am passing my own options in for the details of what I am working on: below is the PHP and following will be the INI $html = $this->helper->formBlah(array( 'name'=>'foo', 'value...

Table Decorators on Zend Framework Form

hello i created a form that it decorates as table form its my code for decorates $this->setElementDecorators(array( 'ViewHelper', 'Errors' array(array('data'=>'HtmlTag'), array('tag'=>'td','class'=>'element')), array('Label',array('tag'=>'td')), array(array('row'...

How does one add a 'plain text node' to a zend form?

I'm trying to add a plain text node in a zend form - the purpose is to only dispay some static text. The problem is - im not aware of any such way to do it. I have used 'description' but that HAS to be attached to a form element. Is there any way to simply display some text as part of a form? Zend considers everything as a form eleme...

Zend Form Validator : Element A or Element B

I have two fields in my Zend Form, and i want to apply the validation rule that ensures the user enters either one of the these two fields. $companyname = new Zend_Form_Element_Text('companyname'); $companyname->setLabel('Company Name'); $companyname->setDecorators($decors); $this->addElement($companyname); $company...

How to wrap Zend_Form error message in custom html?

Hi, I need to wrap zend form error messages in custom html. <div class="cerror" id="ID-error"> <div class="ui-widget"> <div class="ui-state-error ui-corner-all" id="IDerror-msg"> %ZEND_FORM_ERROR_MESSAGE% </div> </div> </div> Now I get errors in format: <ul> <li>Error message</li> </ul> I nee...

zend form generate setLabel() dynamically?

Not really sure how to frame this question, so bear with me. On my form, I have categories with multiple fees. I want the categories to be a header or caption with the fees rendered as radio buttons like Category1 rb1 feeName-feeAmount rb2 feeName-feeAmount Category2 rb1 feeName-feeAmount rb2 feeName-feeAmount I have the radio butto...

how does hash element make a secure login on zend framework?

hello all i saw a example for login form same blow code class Form_Login extends Zend_Form { //put your code here public function init($timeout=360){ $this->addElement('hash', 'token', array( 'timeout' => $timeout )); $this->setName('Login'); $username = $this->createElement ( 'text'...

Zend Framework, Zend_Form_Element how to set custom name?

Hello, I have form, where some fields are looks like rows, so I can add/delete them using JS. For example: Field with ID=1 (existing row) <input id="id[1]" type="text" name="id[1]" value="1" /> <input id="name[1]" type="text" name="name[1]" value="100" /> Field with ID=2 (existing row) <input id="name[2]" type="text" name="name[2]...

How do I write a custom validator for a zend form element with customized error messages?

I have a question field with a list of allowed characters : A-Z,0-9,colon (:), question mark (?), comma(,), hyphen(-), apostrophe ('). I have the regex which works fine, in the fashion : $question->addValidator('regex', true, array(<regular expresstion>)) The default error message is something like ''' does not match against pattern ...