Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
When creating a widget with a SimpleTag, use the attributes below to configure its functionality.
Attribute types
There are two types of widget attributes:
- configuration attributes that set form views of widgets.
- event-related attributes that set actions when users interact with the widgets.
Configuration attributes description
Attribute | Type | Description | Available in | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
beginDate | String | Specify a minimum possible date for a field.
| <datetime> | ||||||||||||||||||
buttonType | String | Specify athe button style for forms and lists. The disabled buttons appear in gray.
| <button> | ||||||||||||||||||
canExcludeAll | Boolean | Specify the attribute to deselect items.
| <multiselect> | ||||||||||||||||||
canRead | Boolean | Specify the attribute to make the referred dictionary available | |||||||||||||||||||
canCreate | Boolean | Specify the attribute to add the button | |||||||||||||||||||
class | String | Define the CSS styles classes description. Define the attribute it in the Template field of the widget. Then, describe it in the CSS field.
| All Simple Tags (except for Portal Tags <attachment> | ||||||||||||||||||
condition | String | Specify the condition. It is an equivalent of Reference Qualifier in the agent interface.
| |||||||||||||||||||
doClose | Function | Specify the function to execute when the modal window is closed.
| |||||||||||||||||||
endDate | String | Specify a maximum possible date for a field.
| <datetime> | ||||||||||||||||||
fixedCondition | String | Specify a condition applied to the list. Unlike the condition specified with the condition attribute, this condition is fixed and cannot be removed; it can be only specified more precisely. The attribute work logic is similar to the Reference Qualifiers (fixed). | |||||||||||||||||||
isFixed | Boolean | Disable the changing of the condition value by making attribute equal to 'true'.
| |||||||||||||||||||
isMandatory | Boolean | Enable setting a mandatory status to a field. To do so, set the attribute equal to 'true'.
| All Simple Tags (except for Portal Simple Tags and <attachment> | ||||||||||||||||||
isPortal | Boolean | Enable the display of the attributed widget on the Self-Service Portal. | |||||||||||||||||||
isShow | Boolean | Enable the display of the modal window.
| |||||||||||||||||||
isUserScripts | Boolean | Disable the client scripts execution in a form. | |||||||||||||||||||
isVisible | Boolean | Disable the visibility of a widget. By default, the attribute is equal to 'true'.
| All Simple Tags (except for <attachment>) | ||||||||||||||||||
label | String | Speicy the field label with the text information generally describing the field content.
| All Simple Tags (except for <attachment> | ||||||||||||||||||
model | String | This attribute points to the client controller data object. When the model data changes, it is automatically transferred to data of the client script.
| All Simple Tags (except for <attachment> <remform>) and <dropdownMenu> | ||||||||||||||||||
modelId | String | Use this attribute to specify the Record Extended Model ID when configuring a form extension. | |||||||||||||||||||
options | Array | Specify the options available for selecting. Use the CodeMirror JSON formatting to set the necessary options.
| |||||||||||||||||||
placeholder | String | Specify a placeholder for a text field.
| |||||||||||||||||||
readOnly | Boolean | To make a fiels read-only, set the attribute value equal to 'true'.
| All Simple Tags (except for Portal Tags, <attachment> | ||||||||||||||||||
recordId | String | Specify a record ID for the extention. When using, do not forget to specify a table (use the tableName attribute for this). See the example code for the <rem> SimpleTag.
| |||||||||||||||||||
reportId | String | Specify the report ID for viewing.
| |||||||||||||||||||
saveButtonCaption | String | Specify a text displayed on the Save button on the portal form.
| <remform> | ||||||||||||||||||
style | String | Specify the display settings (size, font, color, and etc.) of the widget elements using the CSS syntax.
| All Simple Tags (except for <attachment> | ||||||||||||||||||
tableId | Big Integer | Specify the referenced dictionary by its ID. | |||||||||||||||||||
tableName | String | Specify the referenced dictionary.
| |||||||||||||||||||
title | String | Specify the modal window title.
| |||||||||||||||||||
value | String (Array for the <list> tag) | Specify the default value for a field.
| All Simple Tags (except for Portal Tags | ||||||||||||||||||
values | String | Specify the default value for a field.
|
Event-related attributes
Attribute | Description | |||||
---|---|---|---|---|---|---|
event-change | Specify the actions performed when the change event occurs.
| |||||
event-click | Specify the actions that should be performed when the click event occurs.
|
Widget data input and output
A widget template components:
- Template specifies the widget view and the way it displays with HTML. It also allows end-users to input and to interact with data.
- Client script runs a JS script on the client-side, so that it receives data from the server-side, processes data before rendering, then passes it to the widget template. Also, the client script passes the data input received to the server-side.
In the widget template scripts, use data input for passing the data values to a widget for any purpose. The client script uses the data object to access server data. After processing data by the client script, invoke the s_widget.serverUpdate() method to send the data to the server controller. When calling this method, the server script data object automatically overwrites the client controller data object.
Input and output fields
Widget elements can be defined as input fields and manage the input data in the way you want.
The code below implements data input using the model widget attribute, then after the data gets updated on the client-side, this value passes to the <h1>
header.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<string model="data.input"> </string> <h1> {data.input} </h1> |
The <string>
field is a text field that allows a user to enter some text information. The <h1>
header dynamically displays this text with the {data.input}
object.
Multiple data output
The examples below describe how to place the values into two fields and output the joined value of them formatted with "h1 header" style in two different ways.
Example 1
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<string model="data.lastname" event-change=";(( ) => { const lastname = s_widget.getFieldValue('lastname') || ''; const firstname = s_widget.getFieldValue('firstname') || ''; s_widget.setFieldValue('fullname', lastname + ' ' + firstname) } )();"> </string> <string model="data.firstname" event-change=";( () => { const lastname = s_widget.getFieldValue('lastname') || ''; const firstname = s_widget.getFieldValue('firstname') || ''; s_widget.setFieldValue('fullname', lastname + ' ' + firstname) })();"> </string> <h1>{data.fullname}</h1> |
Example 2
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
;(() => { window.s_widget_custom = window.s_widget_custom || {}; window.s_widget_custom.updateFullname = function() { const lastname = s_widget.getFieldValue('lastname') || ''; const firstname = s_widget.getFieldValue('firstname') || ''; s_widget.setFieldValue ('fullname2', lastname + ' ' + firstname) } } )(); |
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<string model="data.lastname" event-change="s_widget_custom.updateFullname();"> </string> <string model="data.firstname" event-change="s_widget_custom.updateFullname();"> </string> <h1>{data.fullname2}</h1> |
Table of Contents | ||
---|---|---|
|