DWKitForm
DWKitForm is component which displays forms created in DWKitFormBuilder.
import {DWKitForm, initDefaultState, initDefaultStateFormUrl, validate, checkConditions} from "./scripts/optimajet-form.js";
<DWKitForm
formName={formName}
data={data}
model={model}
errors={errors}
dataChanged={(form, {key, value}) => {
...
}}
eventFunc={(args) => {
...
}}
getAdditionalDataForControl={this.props.additionalFetch.bind(this, () => {
...
})}
hideControls={hideControls}
readOnlyControls={readOnlyControls}
readOnly={readOnly}
uploadUrl={dataupload}
downloadUrl={datadownload}
autoCheckConditions={true}
autoValidate={true}
/>
Parameters:
# | Name | Type | Comment |
---|---|---|---|
1 | model | JSON or Object | Form description |
2 | data | JSON or Object | Form data |
3 | modelurl | string | Form request URL |
4 | dataurl | string | Data request URL |
5 | errors | Object | Object containing form errors |
6 | hideControls | Array | List of control names which must be hidden |
7 | readOnlyControls | Array | List of control names which are read only |
8 | readOnly | bool | The flag defines the form is available for editing |
9 | dataChanged | function(form, {key, value}) { ... } | Handling data changes in forms. |
10 | eventFunc | function (obj, p) { ... } | Handling form events. |
11 | eventErrFunc | function(obj, message) { ... } | Handling form errors. |
12 | getFormFunc | function(name) { ... } | Callback function for getting source form by name |
13 | getAdditionalDataForControl | function(control, {startIndex, pageSize, filters, sort, model}, callback) { ... } | Additional data request. Used in pager controls, such as Dictionary and GridView. |
14 | downloadUrl | string | The url for downloading files. Use for controls which operate files |
15 | uploadUrl | string | The url for uploading files. Use for controls which operate files. |
16 | autoCheckConditions | boolean | Enable internal checking conditions inside a form (ReadOnly, Visible conditions). |
17 | autoValidate | boolean | Enable internal validation. |