formData.view.model
Provides read/write access to the properties of the form fields of the current record's attributes.
NOTE
To access the values of the attributes, as stored in the form fields, see formData.model.
To access the values of the attributes, as stored in the database, see ebs.getFormEntity.
To access the values of the attributes, as stored in the form fields, see formData.model.
To access the values of the attributes, as stored in the database, see ebs.getFormEntity.
Sytax
Copy
formData.view.model.{attributeName: string}.{isOptional|isRecommended|isRequired|readonly|required|visible|hint|errorHint}
| Parameter | Type | Description |
|---|---|---|
attributeName
|
string | Name of the record attribute for which you wish to edit the form field's properties. |
Properties
| Property | Type | Description |
|---|---|---|
.isOptional
|
boolean | Sets the attribute's form field as optional. |
.isRecommended
|
boolean | Sets the attribute's form field as recommended. |
.isRequired
|
boolean | Sets the attribute's form field as required. |
.readonly
|
boolean | Sets the attribute's form field as readonly. |
.required
|
boolean | Deprecated. Use .isRequired instead. |
.visible
|
boolean | Sets the attribute's form field visibility. Setting the property to false, completely removes the field from the web page's Document Object Model |
.hint
(v24.4 or later) |
string | Displays a help text next to the attribute field. Gives precedence to .errorHint. |
.errorHint
(v24.4 or later) |
string | Displays a red help text next to the attribute field. Takes precedence over .hint. |
.minValue
(v24.4 or later) |
date | Sets a minimum date value for date, datetime, and invariant date attribute fields. |
.maxValue
(v24.4 or later) |
date | Sets a maximum date value for date, datetime, and invariant date attribute fields. |
HINT
The
The
.errorHint property value replaces the .hint text in the user interface. To disable the .errorHint and revert to the .hint text, set the .errorHint value to an empty string.Examples
In this example:
- We use the getUserRoles() function to retrieve the security roles of the currently logged user.
- If the roles don't include the clearance security role, we use the .visible property of formData.view.model to hide the SSN attribute field.
Copy
if (!getUserRoles().includes("clearance")) {
formData.view.model.SSN.visible = false;
}
In this example, we configure the following date limits for the myDate attribute:
- A minimum date of 2025-10-24.
- A maximum date of 2026-09-11.
- A minimum date two days from the current date.
- A minimum date equal to the value of myOtherDate attribute.
Copy
formData.view.model.myDate.minValue = new Date('2025-10-24');
formData.view.model.myDate.maxValue = new Date('2026-09-11');
//set it 2 days from now
let minDate = new Date();
minDate.setDate(minDate.getDate() + 2);
formData.view.model.myDate.minValue = minDate;
//set it with a value from the model
formData.view.model.myDate.minValue = formData.model.myOtherDate;