Field Properties
Common properties of field
Property | Default | Accepted values | Description |
type | none |
| Type of field |
label | none |
| Label of field |
model | none |
| Name of property in the model |
id | auto-generated |
|
|
inputName | none |
| set |
featured |
|
| is it a featured (bold) field? Can be a function too. |
visible |
|
| if |
disabled |
|
| if |
required |
|
| If |
multi |
|
| if |
default | none | any | Default value of the field (used when creating a new model) |
hint | none |
| Show this hint below the field |
help | none |
| Tooltip/Popover triggered by hovering over the question icon before the caption of field. You can use HTML elements too. |
none |
| Validator for value. It can be an array of functions too. | |
none | Amount of time in milliseconds validation waits before checking, refer to validation | ||
styleClasses | none |
| Custom CSS style classes. They will be appended to the |
none |
| Array of button objects. This is useful if you need some helper function to fill the field. (E.g. generate password, get GPS location..etc)* | |
none |
|
Common methods of field
Method | Description |
| A read formatter function where you can format the model value to the field |
| A write formatter function where you can format the field value to the model |
Common events of field
Name | Attributes | Description |
|
| Triggered if the value of field is changed. |
|
| Triggered if validation of field is executed. |
Example
Dynamic visibility
With the visible, disabled, readonly
and featured
properties, you can also show or disable fields dynamically.
Those properties can take a Function
with a model
parameters and expect a Boolean
in return.
Generated values
values
For fields select, checklist, selectEx or vueMultiSelect, the values
property can be a Function
. In this case, you can dynamically generate the items.
Custom Attributes
You can add custom HTML Attributes, such as data-attributes
, to fields by using an attributes
object.
You can also specify the attributes of the surrounding wrapper and label:
The attributes object is broken up into "wrapper", "input" and "label" objects which will attach attributes to the respective HTML element in the component. All VFG Core fields support these, where applicable.
If you do not specify where the attributes go, and just provide a flat "attributes" property, then the attributes will be assigned to the "input" element on the component by default.
Last updated