KendoReact Form - OnSubmit

4 posts, 1 answers
  1. Anthony
    Anthony avatar
    9 posts
    Member since:
    Dec 2017

    Posted 11 Feb Link to this post

     

     

    I would like to expand on the example in the docs: https://www.telerik.com/kendo-react-ui/components/form/

    When the form is submitted, I want to post the form data to an api end point which may "clean/update" the data and return back to client for additional input.  Once the response is returned, I want to update the corresponding fields; however, I don't see how I would be able to update the Form's fields using some like the following:

    formRenderProps.onChange('city', { value: 'Philadelphia' });

    Is there a better appro

  2. Anthony
    Anthony avatar
    9 posts
    Member since:
    Dec 2017

    Posted 11 Feb in reply to Anthony Link to this post

    I accidentally posted before I was finished.

    Is there a better approach to updating the Form's state.

     

    Thanks 

    Anthony

  3. Answer
    Stefan
    Admin
    Stefan avatar
    3034 posts

    Posted 11 Feb Link to this post

    Hello, Anthony,

    If the entire Form has to be updated/reset we can suggest checking the following example showcasing how to update the Form data:

    https://www.telerik.com/kendo-react-ui-develop/components/form/advanced-scenarios/#toc-resetting-the-form-initial-state

    I hope this is helpful.

    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/.

  4. Anthony
    Anthony avatar
    9 posts
    Member since:
    Dec 2017

    Posted 16 Feb in reply to Stefan Link to this post

    Thanks Stefan.  

    I glossed by this one because I was trying to use the html control state to manage subsequent form posts.  I was focused on the example above this one.  The one you suggested is exactally what I needed 

    A subtle point is the use of the key attribute on the Form.   When I didn't have it, the controls did not update with the new values.  I have used key  when mapping a collection of objects, but I have never seen it used on a From.  My understanding is it's needed by React to determine if the virtual DOM needs to update the actual DOM.

    Thanks for your help.

Back to Top