Controlled Component does not work when parameters are passed via props into Field Component

1 Answer 63 Views
Form Input
Gabriel
Top achievements
Rank 1
Gabriel asked on 19 Feb 2022, 10:47 AM

Hi all,

Please refer to this sample: https://stackblitz.com/edit/react-gfiaun?file=app/main.tsx

I am facing an issue whereby the controlled component does not update accordingly if the props are passed in via Field Prop. 

In Field test1, the controlled component works as intended.

In Field test2, the controlled component does not work as expected, even though onHandleChange2 is still being executed and the value is still been set as seen in console. 

I would like your advice on why this happens. Thank you!

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 21 Feb 2022, 07:28 AM

Hello,

Thank you for the example.

In general, controlling the value of the Field components is not recommended via the value property. The Form is controlling the value of the components in order to have full information for the entire Form stat.

https://www.telerik.com/kendo-react-ui/components/form/api/FieldProps/#toc-onchange

If you share more information about the end goal we can recommend how it can be done.

Regards,
Stefan
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Form Input
Asked by
Gabriel
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or