Skip to main content
Version: 9.6

DataControl

Example
<div id="data_control_test"
data-win-control="HFWinJSCtrl.DataControl"
data-win-options="{
defaultValue: {
testEntry: 'test'
},
onChanged: HFFormdefinition.Namespace.Method
}"></div>
Note

The DataControl is a hidden control that can be used to store data in the form. The data is stored in the form as a JSON string.

FormControl Options

defaultValue

Provide a default object for the control. A custom code function can be used to set defaultValue.

How to use: defaultValue: { testEntry: 'testValue' }
Type: object | function
Signature: function() => object

doNotCopy

Set "true" whenever the field should get deleted if form is copied.

How to use: doNotCopy: true
Type: boolean

onChanged

Call a pre-defined JS-method to do something when the status of the control changes.

How to use: onChanged: HFFormdefinition.Namespace.Method
Type: function
Signature: function(value: object) => void

persistent

The value "user" sets the initial value of the DataControl to the value of the previous form item of the current user and overwrites any defaultValue.

How to use: persistent: 'user'
Type: 'user'

Stored data

The simplest storage – id and the filled-in stringified value:

{
"id": "data_control_test",
"value": "{\"testEntry\":\"test\"}"
}