-
Notifications
You must be signed in to change notification settings - Fork 492
Open
Labels
Description
Observed behavior
Please provide as many details as you can:
- Hosting type
- [] Form.io
- Local deployment
- Formio Angular version: 10.0.1
- Frontend framework: Angular 21
- Browser: Chrome
- Browser version: 145.0.7632.76
Steps to Reproduce
- Create a new Angular 21 project.
- Install and configure Formio Angular.
- Add a TextField component to a form.
- Run the application and open the browser console.
Expected behavior
The TextField component should render correctly without any errors in the browser console.
Observed behavior
When adding a TextField component, the following error appears in the browser console:
An error occurred within custom function for widget
TypeError: Cannot read properties of undefined (reading 'widget')The stack trace points to:
at Object.customDefaultValue (TextField.edit.display.js:104:23)
at DefaultEvaluator.execute (Evaluator.js:174:71)
at DefaultEvaluator.evaluate (Evaluator.js:149:34)
at Object.evaluate (utils.js:26:34)
at _TextAreaComponent.evaluate (Element.js:557:32)
at _TextAreaComponent.getCustomDefaultValue (Component.js:2670:33)
at get defaultValue (Component.js:2700:29)
at get defaultValue (Multivalue.js:69:27)
at get defaultValue (TextArea.js:510:34)
at new _Component (Component.js:406:51)The error seems to originate from the following method in TextField.edit.display.js:
customDefaultValue: (value, component, row, data, instance) => {
if (!data.widget) {
const originalWidget = getOriginalWidget(instance);
const widgetType = data['widget.type'] || originalWidget?.type;
if (widgetType && widgetType !== 'input') {
if (originalWidget?.type === widgetType && !_.isEmpty(_.omit(originalWidget, 'type'))) {
return _.omit(originalWidget, 'language');
}
const defaultSettings = getDefaultWidgetSettings(widgetType);
if (defaultSettings) {
return defaultSettings;
}
}
}
return value;
},It appears that data is undefined when customDefaultValue is executed
Reactions are currently unavailable