set_fieldset(Fieldset $fieldset)
If you have created a standalone Fieldset_Field object (i.e. not via the Fieldset class), you can use the set_fieldset method to assign the field object to a fieldset object.
静态 | 否 | ||||||
---|---|---|---|---|---|---|---|
参数 |
| ||||||
回传 | Fieldset_Field 物件,鍊结用 | ||||||
範例 |
|
The Fieldset_Field class defines a single field inside a fieldset. It defines the type of field, how the field should be rendered, and which validation rules should be used when validating field input.
Although it is technically possible to create stand-alone Fieldset_Field instances, normally they will be created as part of a Fieldset, using the Fieldsets add_field() method.
If you have created a standalone Fieldset_Field object (i.e. not via the Fieldset class), you can use the set_fieldset method to assign the field object to a fieldset object.
静态 | 否 | ||||||
---|---|---|---|---|---|---|---|
参数 |
| ||||||
回传 | Fieldset_Field 物件,鍊结用 | ||||||
範例 |
|
Set or change the label of a field.
静态 | 否 | ||||||
---|---|---|---|---|---|---|---|
参数 |
| ||||||
回传 | Fieldset_Field 物件,鍊结用 | ||||||
範例 |
|
Set or change the HTML form field type.
静态 | 否 | ||||||
---|---|---|---|---|---|---|---|
参数 |
| ||||||
回传 | Fieldset_Field 物件,鍊结用 | ||||||
範例 |
|
Set or changes the value of the field. For radio buttons and checkboxes, you can choose to repopulate, which will recalculate the "checked" value of the field based on the current and the passed value.
静态 | 否 | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
参数 |
| |||||||||
回传 | Fieldset_Field 物件,鍊结用 | |||||||||
範例 |
|
Set or changes the fields description. The description is mapped to the {description} ta in the form field template, and can for example be used to display a help text.
静态 | 否 | ||||||
---|---|---|---|---|---|---|---|
参数 |
| ||||||
回传 | Fieldset_Field 物件,鍊结用 | ||||||
範例 |
|
Sets or resets a custom form field template for this field.
静态 | 否 | ||||||
---|---|---|---|---|---|---|---|
参数 |
| ||||||
回传 | Fieldset_Field 物件,鍊结用 | ||||||
範例 |
|
If you don't pass anything, or pass null, the default field template as defined in the form.php config file will be used.
Set a custom error message for a specific validation rule.
静态 | 否 | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
参数 |
| |||||||||
回传 | Fieldset_Field 物件,鍊结用 | |||||||||
範例 |
|
Checks if a custom message for a validation rule is defined, and if so, the message is returned.
静态 | 否 | ||||||
---|---|---|---|---|---|---|---|
参数 |
| ||||||
回传 | Mixed, string if there is a custom message, or null if not | ||||||
範例 |
|
Add a validation rule to a field, either an internal validation rule identified by name, or a valid callback that validates the field.
静态 | 否 | ||||||
---|---|---|---|---|---|---|---|
参数 |
| ||||||
回传 | Fieldset_Field 物件,鍊结用 | ||||||
範例 |
|
When you set the required rule, the "required" attribute of the form input tag will be set.
Removes a validation rule to a field, identified by either an internal validation rule identified by name, or a valid callback that validates the field.
静态 | 否 | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
参数 |
| |||||||||
回传 | Fieldset_Field 物件,鍊结用 | |||||||||
範例 |
|
When you remove the required rule, the "required" attribute of the form input tag will be removed if $set_attr is set to true.
Set one or more HTML field attributes for the field.
静态 | 否 | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
参数 |
| |||||||||
回传 | Fieldset_Field 物件,鍊结用 | |||||||||
範例 |
|
If you pass null as a value, the attribute will be removed from the field attribute list.
Get one or all HTML field attributes of the field.
静态 | 否 | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
参数 |
| |||||||||
回传 | Mixed, a single attribute value, or multiple values in an array if $key was an array of attributes | |||||||||
範例 |
|
Set one or more options. Only valid for radio buttons, checkboxes and selects.
静态 | 否 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
参数 |
| ||||||||||||
回传 | Fieldset_Field 物件,鍊结用 | ||||||||||||
範例 |
|
取得此 Field 关联的 Fieldset 物件。
静态 | 否 |
---|---|
参数 | 无 |
回传 | Fieldset 实例 |
範例 |
|
Fieldset add() 方法的别名。
Fieldset add_before() 方法的别名。
Fieldset add_after() 方法的别名。
为该栏位产生表单 HTML。
静态 | 否 |
---|---|
参数 | 无 |
回传 | 字串,产生的 HTML |
範例 |
|
Validation input() 方法的别名, 并为目前栏位回传输入值。回传 null 如果没有输入值存在。
Validation validated() 方法的别名, 并为目前栏位回传验证的输入值。回传 null 如果没有输入值存在。
Validation error() 方法的别名, 并在此栏位执行验证之后回传任何存在的错误讯息。回传 false 如果没有侦测到错误。