Using Select Element of Zend_Form

intro
This article provides an example of using select element(Zend_Form_Element_Select) of Zend_Form. It also shows how to use custom filter(My_Filter_ArrayValue) created in previous article. You can download the source code of this article from here.
You can see the screens from the demonstration site.

1.Create bootstrap.php and config.ini
Create the file application/bootstrap.php with the following content.
Please modify yourBaseUrl properly.

Create the file application/config.ini with the following content.
Please modify database.params.* properly.

The following tables are used in this article.
2.Create Models
Create the file application/models/Members.php with the following content.

Create the file application/models/Roles.php with the following content.

Create the file application/models/forms/MemberForm.php with the following content.

Create the file application/models/forms/RoleForm.php with the following content.
3.Create Controllers
Create the file application/constorllers/MemberController.php with the following content.
The controller extends My_Controller_Simple created before.
4.Create Views
Create the file application/views/scripts/member/list.phtml with the following content.

The following content shows the usage of filter for displaying label of select element.

Create the file application/views/scripts/member/detail.phtml with the following content.
It uses the filter in same way as upper-mentioned content.

Create the file application/views/scripts/member/form.phtml with the following content.

Create the file application/views/scripts/computer/finish.phtml with the following content.

5.Check
Access the web server and check the select element of form and displaying of it.

Leave a Reply

Your email address will not be published. Required fields are marked *