Custom ui:widget will not alter the formData
See original GitHub issuePrerequisites
- I have read the documentation;
Description
When using ui:widget the field will not change the formData of the form, unlike when not using ui:widget any change in the field will be seen in the formData when the form is submitted.
Suggested solution:
Shall I change the formData of the form manually when the field text changes? if so, is there an example to do so?
Steps to Reproduce
- Create the class that represent the custom UI, and use the following for render:
return (
<div >
{this.props.children}
</div>
)
- Add to the
schema.properties"City": {type: "string", title:"City"} - Add to the
schema.properties"City": { "ui:widget": DefaultInput, classNames: "col-md-4"}
Where City is the name of the custom component.
and DefaultInput is the class that represent the custom ui of field.
Expected behavior
To see the value of the custom text field when submit the form:
onSubmit = ({formData}) => console.log(formData);
Actual behavior
What I see is:
{City: undefined}
Version
1.1.4
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Custom ui:widget will not alter the formData - Stack Overflow
if you use custom 'ui:widgets' you have to use the json-schema-form onChange method when any item's value gets changed and after that you ......
Read more >Advanced customization - React Jsonschema form
The following props are passed to a custom field template component: id : The id of the field in the hierarchy. You can...
Read more >Advanced Form - inmation Docs!
Change Request for „UI Schema“ ; ui:widget. This property is used to select the specific widget to use as the input control for...
Read more >react-jsonschema-form-semantic - npm
There are no other projects in the npm registry using ... The uiSchema ui:widget property tells the form which UI widget should be...
Read more >Capture Form Data - Appsmith
Multiple widgets can be dragged inside the form widget to capture data. ... Any of the required fields inside the form are not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

You must keep the same type of value. Because if you firstly render this widget (I suppose that you use
<input>) without the default value then actual value will be undefined or null and later if you type something into the input then it will be a string and React doesn’t like switching the types. If you look into theBaseInput.jsyou can see that there is condition which sets the null value to the string"".related SO
@akedar21 can you make a new issue with a codepen link so it’s easy to reproduce?