Closed prajeeshbs closed 2 years ago
The code is as follows
<TextField {...form.$("phone.countryCode").bind()} value={222} /> The form setup is as follows
<TextField {...form.$("phone.countryCode").bind()} value={222} />
{ name: "phone", fields: [ { name: "countryCode", label: "Country Code:", bindings: "TextField", placeholder: "+", rules: "required", } ] }
The value displays correctly in the textfield. But when i submit the form, it shows "required" error.
Is assume field.input.onChange is not triggered when we set the value like this and hence the mobx field is not updated with the value.
Any idea on how to fix this?
you have to pass the value to the field definition or by using the update/set/bind methods, not passing it directly to the component.
The code is as follows
<TextField {...form.$("phone.countryCode").bind()} value={222} />
The form setup is as followsThe value displays correctly in the textfield. But when i submit the form, it shows "required" error.
Is assume field.input.onChange is not triggered when we set the value like this and hence the mobx field is not updated with the value.
Any idea on how to fix this?