zend-form-element

Setting selected item in custom Zend_Form_Element

Hello Everyone, I have created my own little form element for inputting time's. Since I need this on a few places in my application, i decided to create a seperate element for it. Here is the code so fa: class EventManager_Form_Element_Time extends Zend_Form_Element { public function init() { parent::init(); $...

Passing variables to a Custom Zend Form Element

Hi, I'm trying to create a custom form element which extends Zend_Form_Element_Text with a validator (so I don't have to keep setting up the validator when I use certain elements). Anyway, I'm having trouble passing $maxChars variable to it when I instantiate it in my Main form. I've provided my shortened code below This is my custom e...

How can I append a description to a Zend_Form_Element?

I have the following Zend_Form_Element: $imginstructions = "Some description"; $img = $this->createElement('select','img'); $img->setAttrib('class', 'image-select'); $imgdecorator = $img->getDecorator('Description'); $imgdecorator->setOption('escape', false); $img->setLabel('Image:') ->setRequired(true) ...

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

How to detect the specific elements (TextBox vs Arrow) of a dijit FilteringSelect

I'm trying have default values for Zend_Dojo_Form_Elements be set to '' when a user clicks into the element. This works fine for a TextBox and partially for a FilteringSelect The FilteringSelect clears, but it does it when you click on the drop down arrow too, causing the drop down to not work. I'd like to have it clear only when you ...

Extending Zend_View_Helper_FormElement

Hi, I have created this file at My/View/Helper/FormElement.php <?php abstract class My_View_Helper_FormElement extends Zend_View_Helper_FormElement { protected function _getInfo($name, $value = null, $attribs = null, $options = null, $listsep = null ) { $info = parent::_getInfo($name, $value, $attribs, $optio...

Zend_Form: when print elements of form in view- form tag dod't created

Hi, Problem: When print elements of form in view, form tag don't created My View: <?php /****** print elements and inser label:: have to be done in this way for integrate cushycms ********/ echo $this->form->empty; ?> <label>Ad Title</label> <?php echo $this->form->adtitle; ?> <label></label> <?php echo $this->form->adbody; ?> ...

How can be form field names translated when they generate by Zend_Form?

Hi, How can be form field names translated when they generate by Zend_Form? if we have: <label>Phone</label> in zend label can be translated by: <label><?php echo $this->translate('Phone'); ?></label> but when the label created by Zend_Form: $phone = new Zend_Form_Element('phone'); $phone->setLabel('Phone'); How can be label t...

How to read values from MultiCheckbox in Zend

Hi!, i have a problem with this Zend form element, how can i read the elements status of Multicheckbox? $type= new Zend_Form_Element_MultiCheckbox('typer'); $type->setLabel('Type'); $type->addMultiOptions(array( '1' => 'type1', '2' => 'type2' )); Thanks for the support!....

How can I create Zend Form Element extends A html tag not INPUT

How can I create Zend Form Element implements A html tag not INPUT. I need create something like that: $Link = new Zend_Form_Element_Link( $field_name, array( 'label'=>'THIS IS LINK', 'href'="#", 'other_attrs' => array() ) ); Do I should use loadDefaultDecorators function or either? This Link element is not actually related t...

Zend_Form_Element_Image is needed here?

How can I make image preview and image-loader (to replace existing image) into the form via only one Zend element. Zend Framework have any solution? Zend_Form_Element_Image can be helpfull for that, or I need write my self Zend Element? ...

Zend Framework: How to remove the DtDd Decorator on a Zend_Form_Element_File?

I've tried every thing I can think of and I can't figure out how to display only the ViewHelper decorator on a Zend_Form_Element_File. $UserPhoto = new Zend_Form_Element_File('UserPhoto'); $UserPhoto->setDestination(TMP_DIR); $UserPhoto->addValidator('Count', false, 1); $UserPhoto->addValidator('Size', false, 10240000); // 10 mb max $th...

Zend Framework: Zend Form Select Generate Verbose HTML Using MultiOptions

I have a form that I am trying to add a simple select element to using the following php: $dateFormat = new Zend_Form_Element_Select('dateFormat'); $dateFormat->setLabel('Date Format:'); $dateFormat->setRequired(true)->addValidator('NotEmpty'); $dateFormat->addMultiOptions(array( 'MM/dd/yyyy' => "US S...

Zend_Form_Element_MultiSelect element definition

Is there any way to define wich options in Zend_Form_Element_MultiSelect would be selected by default?? ...

Setting default selected option for Zend_Form_Element_Select

I have a Zend_Form with Zend_Form_Select element. I populate it from array (code inside the *Application_Form_MyForm extends Zend_Form* class): $options = array('first option', 'second option', 'third option'); $this->getElement('mySelect')->addMultiOptions($options); How can I choose which value is gonna be selected automatically, as...

Is it possible to set a class on Zend MultiOptions?

I have a Zend_Form_Element_MultiSelect element. I would like the output to be something like this: <select id="users" multiple="multiple" name="users[]"> <option value="1" class="role-1">User 1</option> <option value="2" class="role-1">User 2</option> <option value="3" class="role-2">User 3</option> </select> Is there a way t...

How would I make a Zend_Form_Element_Hidden tag immutable?

I have a value that needs to be set in the form for processing, but I do not want the user to be able to edit this value. A hidden element will mostly fit my needs, but I'm concerned a clever user could enable the hidden field and change it. Is there a validator or setting on the Hidden element that would require the submitted form valu...

Zend Framework: Working with Form elements in array notation

I would like to be able to add a hidden form field using array notation to my form. I can do this with HTML like this: <input type="hidden" name="contacts[]" value="123" /> <input type="hidden" name="contacts[]" value="456" /> When the form gets submitted, the $_POST array will contain the hidden element values grouped as an array: a...

maxlengh attribute in zend form element

Hello, how to handle the lengh of a form input in ZEND FRAMEWORK.K I WOULD LIKE TO HAVE A MAX OF 4 characters in my zend form element ! Thank you in advance ...

Add many select elements with [] in name

Hello ! I want to be able to add to Zend_Form many Zend_Form_Element_Select. I've got some loop in My_Form_Selects extends Zend_Form with $element = $this->createElement('Select', 'element[]'); $this->addElement($element); but it creates only one select element (Zend_Form ignores [] in element's name). How should I do this ? ...