ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
# Class Phalcon\\Forms\\Form # Class **Phalcon\\Forms\\Form** *extends* abstract class `Phalcon\Di\Injectable` *implements*[*Phalcon\\Events\\EventsAwareInterface*](#), `Phalcon\Di\InjectionAwareInterface`, Countable, Iterator, Traversable This component allows to build forms using an object-oriented interface ### Methods public **setValidation** (*unknown* $validation) ... public **getValidation** () ... public **\_\_construct** (\[*object* $entity\], \[*array* $userOptions\]) Phalcon\\Forms\\Form constructor public <a class="calibre6 pcalibre1" href="">*Phalcon\\Forms\\Form*</a>**setAction** (*string* $action) Sets the form's action public **getAction** () Returns the form's action public <a class="calibre6 pcalibre1" href="">*Phalcon\\Forms\\Form*</a>**setUserOption** (*string* $option, *mixed* $value) Sets an option for the form public *mixed***getUserOption** (*string* $option, \[*mixed* $defaultValue\]) Returns the value of an option if present public **setUserOptions** (*unknown* $options) Sets options for the element public *array***getUserOptions** () Returns the options for the element public <a class="calibre6 pcalibre1" href="">*Phalcon\\Forms\\Form*</a>**setEntity** (*object* $entity) Sets the entity related to the model public *object***getEntity** () Returns the entity related to the model public **getElements** () Returns the form elements added to the form public <a class="calibre6 pcalibre1" href="">*Phalcon\\Forms\\Form*</a>**bind** (*array* $data, *object* $entity, \[*array* $whitelist\]) Binds data to the entity public *boolean***isValid** (\[*array* $data\], \[*object* $entity\]) Validates the form public **getMessages** (\[*unknown* $byItemName\]) Returns the messages generated in the validation public [*Phalcon\\Validation\\Message\\Group*](#)**getMessagesFor** (*string* $name) Returns the messages generated for a specific element public *boolean***hasMessagesFor** (*string* $name) Check if messages were generated for a specific element public <a class="calibre6 pcalibre1" href="">*Phalcon\\Forms\\Form*</a>**add** ([*Phalcon\\Forms\\ElementInterface*](#) $element, \[*string* $postion\], \[*unknown* $type\]) Adds an element to the form public *string***render** (*string* $name, \[*array* $attributes\]) Renders a specific item in the form public **get** (*unknown* $name) Returns an element added to the form by its name public **label** (*unknown* $name, \[*unknown* $attributes\]) Generate the label of a element added to the form including HTML public **getLabel** (*unknown* $name) Returns a label for an element public *mixed***getValue** (*string* $name) Gets a value from the internal related entity or from the default value public **has** (*unknown* $name) Check if the form contains an element public **remove** (*unknown* $name) Removes an element from the form public <a class="calibre6 pcalibre1" href="">*Phalcon\\Forms\\Form*</a>**clear** (\[*array* $fields\]) Clears every element in the form to its default value public **count** () Returns the number of elements in the form public **rewind** () Rewinds the internal iterator public **current** () Returns the current element in the iterator public **key** () Returns the current position/key in the iterator public **next** () Moves the internal iteration pointer to the next position public **valid** () Check if the current element in the iterator is valid public **setDI** (*unknown* $dependencyInjector) inherited from Phalcon\\Di\\Injectable Sets the dependency injector public **getDI** () inherited from Phalcon\\Di\\Injectable Returns the internal dependency injector public **setEventsManager** (*unknown* $eventsManager) inherited from Phalcon\\Di\\Injectable Sets the event manager public **getEventsManager** () inherited from Phalcon\\Di\\Injectable Returns the internal event manager public **\_\_get** (*unknown* $propertyName) inherited from Phalcon\\Di\\Injectable Magic method \_\_get | - [索引](# "总目录") - [下一页](# "Class Phalcon\Forms\Manager") | - [上一页](# "Class Phalcon\Forms\Exception") | - [API Indice](#) »