Widgets in Forms
Last updated
Was this helpful?
Last updated
Was this helpful?
This is the official documentation of the agent_ruby
Ruby agent.
Field Widgets empower your providing various options to display inputs and ease operators in their daily operations.
null
All types
1.0.0
Use the default widget
String
1.0.0
Display a text input with address autocomplete.
Boolean
1.0.0
Display a checkbox with true/false and possibly null values.
StringList
, NumberList
1.0.0
Display a group of checkboxes to select multiple values.
String
1.0.0
Display a color picker to select a color.
Number
1.0.0
Display a currency input.
Date
, Dateonly
, String
1.0.0
Display a calendar date picker
Date
, Dateonly
, Number
, String
, StringList
1.0.0
Users can choose between a limited set of values.
File
, FileList
1.0.0
Users can upload files.
Json
1.0.0
Display a Json editor with syntax highlighting.
Number
1.0.0
Display a standard number input.
NumberList
1.0.0
Display a standard number input to enter a list of number values.
Date
, Dateonly
, Number
, String
1.0.0
Group of radio buttons to choose a value from.
String
1.0.0
Rich text area allowing to input formatted text.
String
1.0.0
Multi-line text area.
String
1.0.0
One-line text input.
StringList
1.0.0
One-line text input to enter a list of string values
Time
1.0.0
Input for entering a time
String
, StringList
1.0.0
Dropdown containing the users available in the current project
The address autocomplete widget allows to input an address as a text value, autocompleted by the Google Maps API.
The above code will produce the following form (when empty):
And once the user starts typing:
default_value
string
optional
1.0.0
Default value when displaying the field for the first time.
description
string
optional
1.0.0
Description shown above the field, with additional help for users.
is_read_only
boolean
optional
1.0.0
Displays a read only field.
is_required
boolean
optional
1.0.0
Requires the user to input a value before validating.
label
string
static value only
required
1.0.0
Field's label.
placeholder
string
static value only
optional
1.0.0
Placeholder shown in the component.
The checkbox widget allows to activate or deactivate a boolean value.
The above code will produce the following form:
default_value
boolean or nil
optional
1.0.0
Default value of the field. Define a value different from nil
in combination to is_required
to receive a not-null value even if the user did not click the widget.
description
string
optional
1.0.0
Description shown above the field, with additional help for users.
is_read_only
boolean
optional
1.0.0
Displays a read only field.
is_required
boolean
optional
1.0.0
If is_required
is set to false (default value), the checkbox widget allows users to choose between 3 states: true
, false
and nil
. Setting is_required
to true
only allows 2 states: true
and false
. In both cases the default value will be nil
if not defined.
label
string
static value only
required
1.0.0
Field's label.
The checkbox group widget allows to select multiple values from a list of options.
The above code will produce the following form:
default_value
String_List or Number_List
optional
1.0.0
Default value when displaying the field for the first time.
description
string
optional
1.0.0
Description shown above the field, with additional help for users.
is_read_only
boolean
optional
1.0.0
Displays a read only field.
is_required
boolean
optional
1.0.0
Requires the user to input a value before validating.
label
string
static value only
required
1.0.0
Field's label.
options
An array of values, or an array of value/label pairs.
required
1.0.0
List of available options in the component. Supported formats:
["Good", "Very good"]
[{"value": 2, "label": "Good"}, {"value": 3, "label": "Very good"}]
proc { |context| ["Good", "Very good"] }
proc { |context| [{"value": 2, "label": "Good"}, {"value": 3, "label": "Very good"}] }
The color picker widget allows to select a color.
The above code will produce the following form:
default_value
string
optional
1.0.0
Default value when displaying the field for the first time.
description
string
optional
1.0.0
Description shown above the field, with additional help for users.
enable_opacity
boolean
static value only
optional
1.0.0
Allow users to select a color with an opacity.
is_read_only
boolean
optional
1.0.0
Displays a read only field.
is_required
boolean
optional
1.0.0
Requires the user to input a value before validating.
label
string
static value only
required
1.0.0
Field's label.
placeholder
string
static value only
optional
1.0.0
Placeholder shown in the component.
quick_palette
string[]
static value only
optional
1.0.0
List of colors to display in the quick palette. The list can be an array of hex colors or rgba colors.
The currency input widget allows to input a currency value.
The above code will produce the following form:
currency
string
required
1.0.0
default_value
number
optional
1.0.0
Default value when displaying the field for the first time.
description
string
optional
1.0.0
Description shown above the field, with additional help for users.
base
Unit
(default value) or Cent
optional
1.0.0
Base unit to use for the value.unitValue is expressed in the currency's base unit.centValue is expressed as a hundredth of the base unit (typically in cents).
is_read_only
boolean
optional
1.0.0
Displays a read only field.
is_required
boolean
optional
1.0.0
Requires the user to input a value before validating.
label
string
static value only
required
1.0.0
Field's label.
min
number
optional
1.0.0
Minimum value allowed.
max
number
optional
1.0.0
Maximum value allowed.
placeholder
string
static value only
optional
1.0.0
Placeholder shown in the component.
step
number
optional
1.0.0
Step between two values.
The date picker widget allows to input a date in a form
The above code will produce the following form :
Note: using a Dateonly
field type will hide the time section from the date picker
default_value
Date
optional
1.0.0
Default value when displaying the field for the first time.
description
string
optional
1.0.0
Description shown above the field, with additional help for users.
format
string
optional
1.0.0
is_read_only
boolean
optional
1.0.0
Displays a read only field.
is_required
boolean
optional
1.0.0
Requires the user to input a value before validating.
label
string
static value only
required
1.0.0
Field's label.
min
Date
optional
1.0.0
The minimum date allowed to be set in the field
max
Date
optional
1.0.0
The maximum date allowed to be set in the field
placeholder
string
static value only
optional
1.0.0
Text will be shown as placeholder if the field is empty
The dropdown widget allows to select a value from a list of options.
The above code will produce the following form:
In this next example, we call a remote api to get a list of products and then perform a custom filter based on given fields of the json response, and return the first 25. This example uses dropdown widget, which provides you with the in the callback context.
default_value
Coherent with Type
optional
1.0.0
Default value when displaying the field for the first time.
description
string
optional
1.0.0
Description shown above the field, with additional help for users.
is_read_only
boolean
optional
1.0.0
Displays a read only field.
is_required
boolean
optional
1.0.0
Requires the user to input a value before validating.
label
string
static value only
required
1.0.0
Field's label.
options
An array of values, or an array of value/label pairs
required
1.0.0
List of available options in the component. Supported formats:
["Good", "Very good"]
[{"value": 2, "label": "Good"}, {"value": 3, "label": "Very good"}]
placeholder
string
static value only
optional
1.0.0
Placeholder shown in the component.
search
static
, dynamic
or disabled
(default)
static value only
optional
1.0.0
Allow users to input text to filter values displayed in the dropdown.
- disabled
: Users need to scroll to find the appropriate option.
- static
: Users can search a value by typing terms in an input. The search will be done in the browser, based on the label.
- dynamic
The search is performed on the agent side, using any custom logic needed to fetch the required options
The file picker allows to upload files
The above code will produce the following form:
default_value
File or File[]
optional
1.0.0
Default value when displaying the field for the first time.
description
string
optional
1.0.0
Description shown above the field, with additional help for users.
is_read_only
boolean
optional
1.0.0
Displays a read only field.
is_required
boolean
optional
1.0.0
Requires the user to input a value before validating.
label
string
static value only
required
1.0.0
Field's label.
extensions
string[]
optional
1.0.0
The whitelist of file extensions allowed. If not specified, any file extension will be accepted
max_size_mb
number
optional
1.0.0
The max file size allowed to upload. Any file size is allowed if left empty. Make sure your server will be able to handle it.
max_count
number (positive integer)
optional
1.0.0
(only available if the field type is FileList
)
The max number of files allowed to be uploaded. If not specified, any number of files is allowed
The JSON editor widget display a rich editor with syntax highlighting for JSON.
The above code will produce the following form:
This widget does not have any options.
The number input widget allows to input a number value.
The above code will produce the following form:
default_value
number
optional
1.0.0
Default value when displaying the field for the first time.
description
string
optional
1.0.0
Description shown above the field, with additional help for users.
is_read_only
boolean
optional
1.0.0
Displays a read only field.
is_required
boolean
optional
1.0.0
Requires the user to input a value before validating.
label
string
static value only
required
1.0.0
Field's label.
min
number
optional
1.0.0
Minimum value allowed.
max
number
optional
1.0.0
Maximum value allowed.
placeholder
string
static value only
optional
1.0.0
Placeholder shown in the component.
step
number
optional
1.0.0
Step between two values.
The number input list widget allows to input a list of number values.
The above code will produce the following form (once the user entered two step values):
allow_duplicates
boolean
static value only
optional
1.0.0
Allow users to enter duplicate values.
allow_empty_values
boolean
static value only
optional
1.0.0
Allow users to enter empty values.
default_value
number[]
optional
1.0.0
Default value when displaying the field for the first time.
description
string
optional
1.0.0
Description shown above the field, with additional help for users.
enable_reorder
boolean
static value only
optional
1.0.0
Allow users to reorder values.
is_read_only
boolean
optional
1.0.0
Displays a read only field.
is_required
boolean
optional
1.0.0
Requires the user to input a value before validating.
label
string
static value only
required
1.0.0
Field's label.
min
number
optional
1.0.0
Minimum value allowed.
max
number
optional
1.0.0
Maximum value allowed.
placeholder
string
static value only
optional
1.0.0
Placeholder shown in the component.
step
number
optional
1.0.0
Step between two values.
The radio group widget allows to select a value from a list of options.
The above code will produce the following form:
default_value
Coherent with Type
optional
1.0.0
Default value when displaying the field for the first time.
description
string
optional
1.0.0
Description shown above the field, with additional help for users.
is_read_only
boolean
optional
1.0.0
Displays a read only field.
is_required
boolean
optional
1.0.0
Requires the user to input a value before validating.
label
string
static value only
required
1.0.0
Field's label.
options
An array of values, or an array of value/label pairs
required
1.0.0
List of available options in the component. Supported formats:
["Good", "Very good"]
[{"value": 2, "label": "Good"}, {"value": 3, "label": "Very good"}]
proc { |context| ["Good", "Very good"] }
proc { |context| [{"value": 2, "label": "Good"}, {"value": 3, "label": "Very good"}] }
The rich text widget allows to input a formatted text value.
The above code will produce the following form:
default_value
string
optional
1.0.0
Default value when displaying the field for the first time.
description
string
optional
1.0.0
Description shown above the field, with additional help for users.
is_read_only
boolean
optional
1.0.0
Displays a read only field.
is_required
boolean
optional
1.0.0
Requires the user to input a value before validating.
label
string
static value only
required
1.0.0
Field's label.
placeholder
string
static value only
optional
1.0.0
Placeholder shown in the component.
The text area widget allows to input a multiline string value.
The above code will produce the following form:
default_value
string
optional
1.0.0
Default value when displaying the field for the first time.
description
string
optional
1.0.0
Description shown above the field, with additional help for users.
is_read_only
boolean
optional
1.0.0
Displays a read only field.
is_required
boolean
optional
1.0.0
Requires the user to input a value before validating.
label
string
static value only
required
1.0.0
Field's label.
placeholder
string
optional
1.0.0
Placeholder shown in the component.
rows
number
optional
1.0.0
Widget's height expressed as a number of rows.
The text input widget allows to input a string value.
The above code will produce the following form:
default_value
string
optional
1.0.0
Default value when displaying the field for the first time.
description
string
optional
1.0.0
Description shown above the field, with additional help for users.
is_read_only
boolean
optional
1.0.0
Displays a read only field.
is_required
boolean
optional
1.0.0
Requires the user to input a value before validating.
label
string
static value only
required
1.0.0
Field's label.
placeholder
string
static value only
optional
1.0.0
Placeholder shown in the component.
The text input list widget allows to input a list of string values.
The above code will produce the following form (once the user entered two tags):
allow_duplicates
boolean
static value only
optional
1.0.0
Allow users to enter duplicate values.
allow_empty_values
boolean
static value only
optional
1.0.0
Allow users to enter empty values.
enable_reorder
boolean
static value only
optional
1.0.0
Allow users to reorder values.
default_value
string[]
optional
1.0.0
Default value when displaying the field for the first time.
description
string
optional
1.0.0
Description shown above the field, with additional help for users.
is_read_only
boolean
optional
1.0.0
Displays a read only field.
is_required
boolean
optional
1.0.0
Requires the user to input a value before validating.
label
string
static value only
required
1.0.0
Field's label.
placeholder
string
static value only
optional
1.0.0
Placeholder shown in the component.
The time picker widget allows to select a time
The above code will produce the following form :
The user dropdown widget allows to input a user or list of users from the project
The above code will produce the following form (once the user has selected some users)
default_value
string
optional
1.0.0
Default value when displaying the field for the first time.
description
string
optional
1.0.0
Description shown above the field, with additional help for users.
is_read_only
boolean
optional
1.0.0
Displays a read only field.
is_required
boolean
optional
1.0.0
Requires the user to input a value before validating.
label
string
static value only
required
1.0.0
Field's label.
placeholder
string
static value only
optional
1.0.0
Placeholder shown in the component.
or static
or static
or static
or static
The Checkbox
widget has no specific options, but its behavior can be customized using the following already existing :
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
Currency code to display in the component. Valid currency is required.
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
The date picker uses moment.js
library under the hood. You can refer to to specify your date display format
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
Using the options
function, you can dynamically change the list of options based on the context, which contains information about the selected records and other values in the form. .
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static
or static