Questions tagged [zend-form]

`Zend\Form` is a class provided by the Zend Framework, an open source PHP 5 object oriented framework. The class assists in creating, rendering, and processing HTML forms.

Zend\Form simplifies form creation and handling in your web application. It performs the following tasks:

  • Element input filtering and validation
  • Element ordering
  • Element and Form rendering, including escaping
  • Element and form grouping
  • Element and form-level configuration

Using Zend\Form allows a programmer to easily create form elements in the PHP code and dynamically specify how the form element will be rendered. It also handles validating the form element upon submission and reports back to the user any errors that it may have encountered while validating the form.

The zend-form tag should be used on questions that have to do with creating forms in the Zend Framework.

For more information visit:
http://framework.zend.com/manual/en/zend.form.quickstart.html

1992 questions
50
votes
11 answers

Zend Framework: How do I remove the decorators on a Zend Form Hidden Element?

I'm trying to remove the default decorators on a hidden form element. By default, the hidden element is displayed like this:
Hidden Element Label (if I had set one)
I don't…
Andrew
  • 227,796
  • 193
  • 515
  • 708
42
votes
14 answers

Zend Form: How do I make it bend to my will?

I've read the manual many times, I've scoured the posts offered by Google on the subject, I have even bought a couple of books that deal with ZF. Now, why am I still confused? I can, using Zend_Form, make a form that validates and functions fine.…
rg88
  • 20,742
  • 18
  • 76
  • 110
26
votes
10 answers

Zend_Form -> Nicely change setRequired() validate message

Say I create a text element like this: $firstName = new Zend_Form_Element_Text('firstName'); $firstName->setRequired(true); Whats the best way to change the default error message from: Value is empty, but a non-empty value is required to a…
dittonamed
  • 940
  • 2
  • 9
  • 17
26
votes
9 answers

How to disable a form element in a Zend Form?

I want to display a Zend Form with one of the elements shown as disabled. I'm setting the value so the user can see it, but I want to disable it so the user can't edit it. This may also involve some sort of css/javascript to ensure that it looks…
Andrew
  • 227,796
  • 193
  • 515
  • 708
23
votes
5 answers

Zend Form: How to set the length of a text input or textarea element?

By default Zend Form Text elements don't have a width specified. Textarea elements have a default of rows="24" and cols="80". But when I set a different value... $body = new Zend_Form_Element_Textarea('body'); $body->setLabel('Body:') …
Andrew
  • 227,796
  • 193
  • 515
  • 708
20
votes
7 answers

Zend Framework - Set 'selected' value in select box dropdown list

I am adding a select element to a Zend_Form instance as follows: $user = $form->createElement('select','user')->setLabel('User: ')->setRequired(true); foreach($users as $u) { if($selected == $u->id) { …
Tom
  • 1,115
  • 1
  • 8
  • 13
20
votes
10 answers

Zend Framework forms, decorators and validation: should I go back to plain HTML?

I am currently working on a pretty large application which contains a lot of forms. Up to this moment, I have always been writing my forms by hand and writing my own validation logic, but I have decided it was about time I started using Zend_Form…
Aron Rotteveel
  • 81,193
  • 17
  • 104
  • 128
19
votes
4 answers

Get post data, Zend Framework

I want to fetch posted data. But I am using no form. The data is postet by a jquery script with method post and I would like to fetch it. I know how to fetch parameters $id = $this->getRequest ()->getParam ( 'id', null ); and form values $message…
DarkLeafyGreen
  • 69,338
  • 131
  • 383
  • 601
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
17
votes
6 answers

How to use Zend Framework Form Hash (token) with AJAX

I have included Zend_Form_Element_Hash into a form multiplecheckbox form. I have jQuery set to fire off an AJAX request when a checkbox is clicked, I pass the token with this AJAX request. The first AJAX request works great, but the subsequent ones…
Shane Stillwell
  • 3,198
  • 5
  • 31
  • 53
16
votes
2 answers

Zend_Form - Array based elements?

Using Zend_Form, how would I create form elements like this: // etc...
leek
  • 11,803
  • 8
  • 45
  • 61
16
votes
10 answers

Add some html to Zend Forms

Im looking for a simple bit of code that will let me add the following html into my zend form:
Thats it, it needs to be above my 'method' element in the form but thats it. For such a simple action I…
bluedaniel
  • 2,079
  • 5
  • 31
  • 49
16
votes
3 answers

Display Zend_Form_Element_Radio on one line

The radio buttons in Zend Framework are displayed in a column (one option per line). How can I remove the br tag from the markup so that all radio options stay in one line? My decorators are: private $radioDecorators = array( 'Label', …
Richard Knop
  • 81,041
  • 149
  • 392
  • 552
1
2 3
99 100