Tell you more about Zend_Form
2012-11-23 11:14
483 查看
Zend_Form makes use of several Zend Framework components to accomplish its goals, including Zend_Config, Zend_Validate, Zend_Filter, Zend_Loader_PluginLoader, and optionally Zend_View.
You have two options for adding elements to a form: you can instantiate concrete elements and pass in these objects, or you can pass in simply the element type and have Zend_Form instantiate an object of the correct type for you.
By default, these do not have any validators or filters. This means you will need to configure your elements with at least validators, and potentially filters. You can either do this (a) before you pass the element to the form, (b) via configuration options
passed in when creating an element via Zend_Form, or (c) by pulling the element from the form object and configuring it after the fact.
Rendering a form is simple. Most elements use a Zend_View helper to render themselves, and thus need a view object in order to render. Other than that, you have two options: use the form's render() method, or simply echo it.
After a form is submitted, you will need to check and see if it passes validations. Each element is checked against the data provided; if a key matching the element name is not present, and the item is marked as required, validations are run with a NULL
value.
All Zend_Form classes are configurable using Zend_Config; you can either pass a Zend_Config object to the constructor or pass it in with setConfig().
Zend_Form_Element tries to solve html mark-up issue through the use of "decorators". Decorators are simply classes that have access to the element and a method for rendering content.
You have two options for adding elements to a form: you can instantiate concrete elements and pass in these objects, or you can pass in simply the element type and have Zend_Form instantiate an object of the correct type for you.
By default, these do not have any validators or filters. This means you will need to configure your elements with at least validators, and potentially filters. You can either do this (a) before you pass the element to the form, (b) via configuration options
passed in when creating an element via Zend_Form, or (c) by pulling the element from the form object and configuring it after the fact.
Rendering a form is simple. Most elements use a Zend_View helper to render themselves, and thus need a view object in order to render. Other than that, you have two options: use the form's render() method, or simply echo it.
After a form is submitted, you will need to check and see if it passes validations. Each element is checked against the data provided; if a key matching the element name is not present, and the item is marked as required, validations are run with a NULL
value.
All Zend_Form classes are configurable using Zend_Config; you can either pass a Zend_Config object to the constructor or pass it in with setConfig().
Zend_Form_Element tries to solve html mark-up issue through the use of "decorators". Decorators are simply classes that have access to the element and a method for rendering content.
相关文章推荐
- I won't tell you this is about graph theory----zjfc bellman-ford算法与spfa算法
- Think more about what you have
- 【HDU2685】I won't tell you this is about number theory
- HDU 2685 I won't tell you this is about number theory 数学结论
- tell him more about myself
- Could you tell something about the Unix System Kernel?
- Probably more than you want to know about keyboarding in Windows Forms
- 解决“You have more than one commit that you are about to submit.”
- Think More About What You Have
- HDU 2685 I won't tell you this is about number theory
- 5 Things They Never Tell You About Making iPhone Apps
- 数论基础定理及其应用(hdu 2685 I won't tell you this is about number theory, hdu 2582 f(n),hdu 1792 A New Chan)
- HDU 2685 I won't tell you this is about number theory
- More than you ever wanted to know about GeoJSON
- [转]What you need to know about transimpedance amplifiers – part 1
- 【字典树】hdu 1075 What Are You Talking About
- How to answer tell me about yourself question.
- Everything You Know About CSS is Wrong!
- 【3】More About Jobs and Job Details
- The more you chase, the emptier your heart will be. On the 11-11 eve.