This is a migrated thread and some comments may be shown as answers.

Reset Single Field to Initial Value

5 Answers 1430 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Veteran
Bill asked on 15 Mar 2021, 05:09 PM

Hi There,

We are using the Kendo React Form library. Is it possible to reset a single field to the initial value that the form supplies? I see the way to reset the entire form, but we are looking to include a reset button next to each input field that would reset the field to it's initial value and also inform the form that it has not been modified.

5 Answers, 1 is accepted

Sort by
0
Bill
Top achievements
Rank 1
Veteran
answered on 15 Mar 2021, 05:35 PM
I think I figured it out using fieldRenderProps.onChange({ value: initialValue }).
0
Stefan
Telerik team
answered on 16 Mar 2021, 05:50 AM

Hello, Bill,

Yes, this is the correct way to reset the value of a single field.

This can also be done on a Form level, by passing the field name:

https://www.telerik.com/kendo-react-ui/components/form/advanced-scenarios/#toc-changing-the-field-value

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.

0
Bill
Top achievements
Rank 1
Veteran
answered on 16 Mar 2021, 06:17 PM
I have a follow up question. Is there a way to reset the fieldrenderprops so the form sees it as having not been modified or touched?
0
Bill
Top achievements
Rank 1
Veteran
answered on 16 Mar 2021, 08:47 PM

Second follow up :-).

Is there a way to use promises or something like that to detect a successful form save in order to disable the save button

0
Stefan
Telerik team
answered on 17 Mar 2021, 06:08 AM

Hello, Bill,

Regarding the questions:

1) Is there a way to reset the fieldrenderprops so the form sees it as having not been modified or touched - Currently, they will be updated as the field value is indeed modified. If we do not change it, this can lead to wrong information in many cases.

2) Is there a way to use promises or something like that to detect a successful form save in order to disable the save button - The Form save (the request to the server) is made by the developer, which means that the developer can use the callback from the server. The KendoReact Form is not making requests to save the data internally, this is why we have no information when the Form is saved in order to provide such a callback.

In general, we recommend submitting new tickets/forum posts for different questions as for example someone may be searching for the same answer, but it will be difficult to find when it is answered in a different topic.

 

Regards,
Stefan
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
Bill
Top achievements
Rank 1
Veteran
Answers by
Bill
Top achievements
Rank 1
Veteran
Stefan
Telerik team
Share this question
or