species/html-form

HTML表单构建和处理。

0.4.5 2019-05-15 09:40 UTC

This package is auto-updated.

Last update: 2024-09-15 22:32:15 UTC


README

安装

composer require species/html-form

合同

节点

节点

getName(): string
getShortName(): string
getParent(): ?ParentNode

setParent(?ParentNode $parent): void
clone(): Node

LeafNode

+ Node

父节点

+ Node, NodeCollection

节点集合

+IteratorAggregate<Node>
+ArrayAccess<Node>
+Countable<Node>

字符串值

getValue(): string
getDefaultValue(): string

getError(): ?string;

submit(string $value, array $context  = []): mixed
reset(?string $newDefaultValue = null): void

数组值

getValues(): array
getDefaultValues(): array

getError(): ?string;
getErrors(): array

submit(array $values, array $context  = []): mixed
reset(?array $newDefaultValues = null): void

表单

表单

+ ArrayValue
+submit(array $values, array $context  = []): bool

fields: FieldSet

字段集

+ ParentNode, ArrayValue

字段列表

+ ParentNode, ArrayValue

getPrototype(): (cloned) Node

字段

输入字段

+ LeafNode, StringValue

TYPES: [
   'text', 'search', 'hidden', 'password',
   'email', 'tel', 'url', 'number', 'range', 'color',
   'date', 'time', 'datetime-local', 'week', 'month',
]
getType(): string

文本区域字段

+ LeafNode, StringValue

复选框字段

+ LeafNode, StringValue

isChecked(): bool

单选字段

+ ParentNode, StringValue

getOptions(): string[]

单选字段

+ LeafNode, StringValue

isChecked(): bool

选择字段

+ LeafNode, StringValue

getOptions(): string[]

多选字段

+ LeafNode, ArrayValue

getOptions(): string[]

提交字段

+ LeafNode, StringValue

isClicked(): bool

待办事项

上传字段

+ LeafNode, StringValue

上传多选字段

+ LeafNode, ArrayValue