Form (class)

Class Form

Form abstraction used to create forms not tied to ORM backed models, or to other permanent datastores. Ideal for implementing forms on top of API services, or contact forms.

Building a form

This class is most useful when subclassed. In a subclass you should define the _buildSchema, _buildValidator and optionally, the _execute methods. These allow you to declare your form's fields, validation and primary action respectively.

You can also define the validation and schema by chaining method calls off of $form->schema() and $form->validator().

Forms are conventionally placed in the App\Form namespace.

Namespace: Cake\Form
Location: 登录查看完整内容