Closed
Description
Category
[x] Enhancement
[ ] Bug
[ ] Question
Version
3.11 (Because 3.12 has an issue on dynamicforms)
Expected / Desired Behavior / Question
I'm using Dynamic Forms in combination with fieldOverrides to create custom field experiences. The current setup works when using it in normal situations: you have a simple field and override it, and update the value in the form.
But if you have multiple fields that have to interact with each other, you need the state
of the containing component to build it up.
In this situation it becomes necessary (eg when using an edit form) to have a moment when you can fill that state with the values of the listitem.
To do this an extra event is necessary: onListItemLoaded
. something like this:
const fieldOverrides: {[key: string]: any} = {
"SomeFieldX": (fieldProperties: IDynamicFieldProps) => this.renderSomeFieldX(fieldProperties),
"SomeFieldY": (fieldProperties: IDynamicFieldProps) => this.renderSomeFieldY(fieldProperties)
};
return <>
<DynamicForm
context={this.props.context as any}
listId={this.props.context.list.guid.toString()}
listItemId={this.props.context.itemId}
onListItemloaded={(listItemDate: any)=> { /* do something to update the state */}
onBeforeSubmit={this._onBeforeSubmit}
fieldOverrides={fieldOverrides}
/></>;