sc-text-box
1 Purpose
sc-text-box places a text box field on a form, allowing the user to enter a single line of text.
The sc-text-box definition provides fields for setting the properties of a text box field and is fully described below.
2 Definition
sc-text-box is defined by a set of name/value pair fields consisting of:
- Required system fields
- Required customizable fields
- Optional customizable fields
Note:
- Default values for fields described in the tables below are shown in bold text.
2.1 Required System Fields
Field | Valid Values | Description |
---|---|---|
componentName | sc-text-box | The component name. |
Example: "componentName": "sc-text-box" |
2.2 Required Customizable Fields
Field | Valid Values | Description |
---|---|---|
name | Any value written in camel case. | Defines the name of the text box field in the document and database. |
Example: "name": "testScTextBox" |
2.3 Optional Customizable Fields
Field | Valid Values | Description |
---|---|---|
defaultValue | Any value | The value to initially load in the text box field. |
Example: "defaultValue": "Apple" |
||
Defaults to no value is initially loaded. | ||
disableSave | true | Entering a value in the text box field does not trigger the Save icon to flash. |
Exiting the form without saving the entered value does not trigger a warning message to display. | ||
Example: "disableSave": true |
||
false | Default value. Entering a value in the text box field does trigger the Save icon to flash. | |
Exiting the form without saving the entered value does trigger a warning message to display. | ||
enabled | false | The text box field is greyed out. |
A Stop icon appears on mouseover. | ||
A value cannot be entered in the text box field. | ||
Example: "enabled": false |
||
true | Default value. A value can be entered in the text box field. | |
fullWidth | true | The text box field displays full width on the form. |
Example: "fullWidth": true |
||
false | Default value. The text box field does not display full width on the form. | |
label | Any value | Defines the name of the text box field on the form i.e. the field label. |
Example: "label": "Test sc-text-box" |
||
Defaults to the text box field displays without a field label on the form. | ||
mandatory | true | The text box field displays as mandatory (i.e. label in red text with an asterisk). |
Saving without a value, a message prompts the user to enter a value for the text box field. | ||
Example: "mandatory": true |
||
false | Default value. The field displays as optional (i.e. label in black text). | |
visible | false | The text box field is not visible on the form. |
Example: "visible": false |
||
true | Default value. The text box field is visible on the form. |
3 Typical Definition
Below is a typical sc-text-box definition, defined with its required fields plus any optional field whose value is typically other than its default value.
{
"componentName": "sc-text-box",
"label": "Test sc-text-box",
"name": "testScTextBox"
}
One or more of the optional fields shown below can be included in the above definition should a value other than their default value be required.
"mandatory": true,
"defaultValue": "This is the default Note",
"disableSave":true,
"enabled":false,
"visible":false,
4 Examples
Example 1
A sc-text-box definition defined with the typically needed fields plus the "mandatory" field.
{
"componentName": "sc-text-box",
"label": "Test sc-text-box",
"name": "testScTextBox",
"mandatory": true
}
Resulting field on the form:
Resulting field on the form after entering a value:
This example illustrates that a value (shown below) exceeding the width of the text box field displayed on the form can be entered, saved and then viewed.
"This is an example of a long sentence that has been entered into a text box field"
Resulting field on the form after saving the entered value:
Resulting field in the document and database after saving the entered value:
"testScTextBox": "This is an example of a long sentence that has been entered into a text box field."