<s:select> / <s:ft_select> / <s:ft_checkbox> / <s:ft_radio>
A select list which can be populated from a data source. You may also use the <ft_select> / <s:ft_checkbox> / <s:ft_radio>
tags as well when within a form table to display a two column table containg a select, checkbox or radio list.
Accepts the following attributes:
Attribute | Required | Description |
---|---|---|
name | Yes | The name of the select list |
required | No | A 1 or 0 defining whether or not a value is required. If 0, the first option of the list will be blank with hyphens. Defaults to 0. |
value | No | The value of the select list |
data_source | No | Optional data source defining where to pull the list options from. See below for details. |
label | No | Only applicable if using a tag prefixed with ft_ and is the label within the left column of the table. |
Data Source
If the data_source
attribute is provided, it defines where the options for the select list should be retrived from. This is always a string delimited by periods, the first element being the type of data source. For example:
hash.users.log_action
table.user_groups.~name~.name
function.App\MyPackage\SomeClass.staticMethod
stdlist.timezone
Below breaks down the four different types of data sources that are available:
hash
The hashes that are defined by back-end developers within the package.yml files of each package. This data source contains two additional segments, the alias of the package, and the alias of the hash. For example:
hash.myshop.product_status
The above should populate the select list with all hash entries within the product_status
hash of the myshop
table.
function
Will call a static method to retrieve the list options. Thie data source contains two additional segments, the fully qualified class name and the static method to call. For example:
function.App\MyPackage\Products.getStatusOptions
The above will call the App\MyPackage\Products::getStatusOptions()
method statically, which expects a string returned being the HTML code of the options to display. One argument will be passed to the method, being the selected value of the list.
table
Retrieve the list options from records in a database table. This data source requires two additional segments, but allows for up to four additional segments. The below table describes the available segments:
# | Required | Description |
---|---|---|
1 | Yes | The name of the database table. |
2 | Yes | The display name of the option. Accepts merge fields such as ~name~ which are replaced by their respective values of each database record. |
3 | No | The column which to sort records within the table by. Defaults to name |
4 | No | The column to use as the value of the list option. Defaults to id |
,br />
For example:
table.user_groups.~name~ (ID# ~id~).name
The above would display a list of all records within the user_groups
table with the group name followed by its id# in parantheses.
stdlist
There are several standardized lists you may also use. This data source only accepts one additional segment, the list to display and can be one of the following:
stdlist.timezone
stdlist.currency
stdlist.country
stdlist.language
Example HTML
<s:select name="status" data_source="hash.users.log_action">
<s:form_table>
<s:ft_select label="Log Action" name="log" data_source="hash.users.log_action">
<s:ft_checkbox label="Log Action" name="log" data_source="hash.users.log_action">
<s:ft_radio label="Log Action" name="log" data_source="hash.users.log_action">
</s:form_table>
Example Output
User Created User Deleted User Undeleted User Activated User Deactivated User Frozen User Unfrozen Defined Initial Password Updated Username Updated Password Updated E-Mail Address Updated Phone Number Updated 2FA Settings Verified E-Mail Address Verified Phone Number Reset Password |
|
User Created User Deleted User Undeleted User Activated User Deactivated User Frozen User Unfrozen Defined Initial Password Updated Username Updated Password Updated E-Mail Address Updated Phone Number Updated 2FA Settings Verified E-Mail Address Verified Phone Number Reset Password |