Phalcon 表单17 Mar 2025 | 阅读 2 分钟 它处理 Web 应用程序中表单的创建和维护。现在,正如我们之前设计的 Web 应用程序一样,我们将添加注册表单。 设计注册表单 更改 index.phtml 视图文件,将注册页面链接添加为控制器。 app/views/index/index.phtml 输出  现在,我们编写注册控制器 app/controllers/SignupController.php 初始化表单 在此表单中,我们提供表单定义,即提供表单的结构。 app/views/signup/index.phtml 输出  验证表单Phalcon 表单与验证组件集成,以提供即时验证。
表单元素Phalcon 提供了一组内置元素,可在您的表单中使用。 所有这些元素都位于 Phalcon\Forms\Element. 中。 名称 | 描述 |
---|
Phalcon\Forms\Element\Text | 生成 INPUT[type=text] 元素 | Phalcon\Forms\Element\Password | 生成 INPUT[type=password] 元素 | Phalcon\Forms\Element\Select | 基于选项生成 SELECT 标签(组合列表)元素 | Phalcon\Forms\Element\Check | 生成 INPUT[type=check] 元素 | Phalcon\Forms\Element\TextArea | 生成 TEXTAREA 元素 | Phalcon\Forms\Element\Hidden | 生成 INPUT[type=hidden] 元素 | Phalcon\Forms\Element\File | 生成 INPUT[type=file] 元素 | Phalcon\Forms\Element\Date | 生成 INPUT[type=date] 元素 | Phalcon\Forms\Element\Numeric | 生成 INPUT[type=number] 元素 | Phalcon\Forms\Element\Submit | 生成 INPUT[type=submit] 元素 |
|