How to get modifiedByField object to update when I undo a change inside <Form>

1 Answer 191 Views
Input
Vincent
Top achievements
Rank 3
Iron
Iron
Iron
Vincent asked on 10 Sep 2021, 07:31 AM

I'm currently using this object provided by the kendoForm injected property:

https://www.telerik.com/kendo-vue-ui/components/form/api/KendoFormInjectedProperty/#toc-modifiedbyfield

When I change a field inside the <FormElement> it adds the field to this object, however once I undo this change (return back to initial value) the field remains inside the object.

Here's a stackblitz to illustrate the problem:
https://stackblitz.com/edit/t7gw96?file=src%2FFormContent.vue

 

How do I remove the fields from this object when they no longer differ from their initial value?

 

1 Answer, 1 is accepted

Sort by
1
Accepted
Plamen
Telerik team
answered on 14 Sep 2021, 12:35 PM

Hi,

Thank you for providing this questions.

The kendoForm injected object is an observable so you could modify it even from the FormContent component as for example it is done in this example - https://stackblitz.com/edit/t7gw96-yudjpu?file=src%2FFormContent.vue

This is one way to achieve this behavior yet we will also think about other possible approaches or adding some special method for handling this behavior for the future versions of the Kendo Form for Vue.  

Regards,
Plamen
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/.

Vincent
Top achievements
Rank 3
Iron
Iron
Iron
commented on 15 Sep 2021, 06:57 AM

How do I know when a form value was reverted back to it's initial value as set in :initial-values?

https://stackblitz.com/edit/t7gw96-evzvtb?file=src%2FFormContent.vue

Currently it only checks if the field is modified or emptied, but I want to check if it's the same as it's initial value and only then remove it from modifiedByField
Plamen
Telerik team
commented on 15 Sep 2021, 09:54 AM

Yes indeed - it was a dummy example. If you want to check for the default values you can pass them to the formContent as for example it is done in this example - https://stackblitz.com/edit/t7gw96-2wardr

Greetings,

Plamen

Tags
Input
Asked by
Vincent
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Plamen
Telerik team
Share this question
or