Questions tagged [zend-form-element]

Zend Framework provides the form class in library to create the form. The form has different elements. This tag is related to form elements provide by zend form class.

Zend Framework ships with concrete element classes covering most HTML form elements. Most simply specify a particular view helper for use when decorating the element, but several offer additional functionality. The following is a list of all such classes, as well as descriptions of the functionality they offer.

  • Zend Form Element Button
  • Zend Form Element Captcha
  • Zend Form Element Checkbox
  • Zend Form Element File
  • Zend Form Element Image etc ...

Forms are relatively easy to create. At the bare minimum, each element or fieldset requires a name; typically, you’ll also provide some attributes to hint to the view layer how it might render the item. The form itself will also typically compose an InputFilter– which you can also conveniently create directly in the form via a factory. Individual elements can hint as to what defaults to use when generating a related input for the input filter.

335 questions
19
votes
4 answers

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: When the form gets…
Andrew
  • 227,796
  • 193
  • 515
  • 708
19
votes
7 answers

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…
Mallika Iyer
  • 700
  • 2
  • 12
  • 23
19
votes
7 answers

How do I use ViewScripts on Zend_Form File Elements?

I am using this ViewScript for my standard form elements:
element->getLabel())) : ?> formLabel($this->element->getName(),…
Sonny
  • 8,204
  • 7
  • 63
  • 134
13
votes
1 answer

Populating Relationship data in Zend Framework 2 Forms via Annotation Builder

Currently, I have article and tag tables. I am trying to auto populate the "Tag" form element as a select box on the article form. What is the best way to go about setting the Value Options of the tags select box from a database table and then also…
13
votes
4 answers

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'); …
emeraldjava
  • 10,894
  • 26
  • 97
  • 170
11
votes
6 answers

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…
Andrew
  • 227,796
  • 193
  • 515
  • 708
10
votes
3 answers

The disabled form element is not submitted

I needed to show some preexisting data from a table and but needed to disable them to prevent user from editing them. So i disabled them $form -> getElement("elementname") -> setAttrib("disable", true); When I submit the form, I found out, that the…
mrN
  • 3,734
  • 15
  • 58
  • 82
10
votes
4 answers

Zend Framework 2 - Form Element Decorators

I want to force the Zend form into Twitter Bootstrap style. I currently iterate through the form fields and write the form info into my bootstrap div construction. I saw in Zend Framework 1(!) that there is a way to do this within a decorator. But…
Ron
  • 22,128
  • 31
  • 108
  • 206
9
votes
3 answers

Customize zend_form Captcha output?

I'm using captcha in my zend_form. $captcha_element = new Zend_Form_Element_Captcha( 'captcha', array('label' => 'Write the chars to the field', 'captcha' => array( 'captcha' => 'Image', 'wordLen' => 6, …
Stann
  • 13,518
  • 19
  • 65
  • 73
9
votes
2 answers

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?
user4210
8
votes
4 answers

How to unset elements in zend form

I have a zend form in which I have many elements. I use form on many places. I have an element of file and that is: $file= new Zend_Form_Element_File('merchantLogo'); $file->setDestination("application_data/merchant/logo/original/"); …
Awais Qarni
  • 17,492
  • 24
  • 75
  • 137
8
votes
5 answers

zend form email validation

I have the following code to generate an input field for user's email address $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email:') ->addFilters(array('StringTrim', 'StripTags')) ->addValidator('EmailAddress') …
Bryan
  • 645
  • 1
  • 6
  • 18
7
votes
2 answers

How to add zend form element at specific position, after once form object has already created?

I have created one user_form class that extends zend form, it has 4 elements username, password, hash for csrf and at last submit button. Creating object of user_form renders all those four element. After validating login in controller action i…
Rajan Rawal
  • 6,171
  • 6
  • 40
  • 62
7
votes
2 answers

How do I allow html tags in label for Zend form element using addElement()?

I am brand new to Zend and I've been given a project to make adjustments on. I'd like to add html to the labels for my form elements but I can't seem to get it right. Here's what I have: $this->addElement('text', 'school_name', array( 'filters'…
6
votes
2 answers

Custom Error Message for Captcha Element In Zend Framework 1.10

I am trying to set my own custom error message onto my Captcha but for some reason it is echoing twice. Here is my captcha code: $captcha = new Zend_Form_Element_Captcha( 'captcha', // This is the name of the input field array('captcha' =>…
Richard Parnaby-King
  • 14,703
  • 11
  • 69
  • 129
1
2 3
22 23