-
Notifications
You must be signed in to change notification settings - Fork 409
Description
Thank you for reporting an issue, suggesting an enhancement, or asking a question. We appreciate your feedback - to help the team understand your
needs please complete the below template to ensure we have the details to help. Thanks!
Please check out the documentation to see if your question is already addressed there. This will help us ensure our documentation is up to date.
Category
[ ] Enhancement
[x] Bug
[ ] Question
Version
Please specify what version of the library you are using: [3.21.0]
If you are not using the latest release, please update and see if the issue is resolved before submitting an issue.
Expected / Desired Behavior / Question
When overriding a Single line of text field in a DynamicForm using fieldOverride, setting a default value should:
Show the value in the form when it renders (based on context, e.g. specific page).
Persist that value into the form model and save it to the list item when the form is submitted.
Observed Behavior
For Lookup columns, this works as expected — default values display and are saved.
For Single line of text columns (example: EntityID):
The default value shows in the UI.
But when saving, the field value is not included in the payload.
Even though we are calling onChanged in useEffect to commit the value, it is still not persisted.
Steps to Reproduce
Create a SharePoint list with a Single line of text field (EntityID).
Render a DynamicForm with a field override for this column.
Use code similar to:
const EntityIDOverride: React.FC<{ fieldProperties: IDynamicFieldProps; currentItem: any }> = ({
fieldProperties,
currentItem,
}) => {
const { columnInternalName, value, onChanged, ...rest } = fieldProperties;
const entityId = currentItem?.currentProperty?.EntityID
? String(currentItem.currentProperty.EntityID)
: '';
React.useEffect(() => {
if (entityId && !value) {
console.log('🔁 Committing EntityID default:', entityId);
onChanged?.(columnInternalName, entityId, true);
}
}, [entityId]);
return (
<DynamicField
{...rest}
columnInternalName={columnInternalName}
value={value ?? entityId}
newValue={value ?? entityId}
defaultValue={entityId}
onChanged={(col, val, validate, additional) => {
console.log('✏️ EntityID changed:', col, val);
onChanged?.(col, val, validate, additional);
}}
/>
);
};
EntityID: (props) => (
),
Load the form from a page where EntityID should be pre-populated.
Save the form.
Result:
Field shows the default value.
On save, the value is not persisted into the list item.
Submission Guidelines
Delete this section after reading
- All suggestions, questions and issues are welcome, please let us know what's on your mind.
- Remember to include sufficient details and context.
- If you have multiple suggestions, questions, or bugs please submit them in separate issues so we can track resolution.
Thanks!