Grommet: How to get touched object for forms on onChange not just on onSubmit

Created on 14 Jun 2020  路  3Comments  路  Source: grommet/grommet

I am trying to add a prompt for Unsaved changes in my Form, So I want to check If the input is dirty or not,

I think it would be a good idea to get the touched object on onChange for forms, Like we have it right now on onSubmit:

onSubmit={({ value, touched }) => {}};
vs
onChange={({ value}) => {}};
:(

enhancement

Most helpful comment

Thank you @netochaves for adding this enhancement! It will be available on our next official release.

All 3 comments

Hey @ShimiSun, correct me if I'm wrong but this will not be a breaking change? Right now onChange is receiving as parameter the form value but if we add another property like touched it will receiving an object and you will have to access the object to get the form value so this can break some implementations.

I think this will be an awesome feature and I want to implement it, my worries are with the backwards compatible.

@netochaves good observation. I don't think this will be a breaking a change, we'll know better once we'll have a concrete PR
too look at, would you like to take a stab at it and see if you are running into potential changes and submit a draft with your observations? It will help us keep the conversation running.

Thank you @netochaves for adding this enhancement! It will be available on our next official release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nnbrandon picture nnbrandon  路  3Comments

mars76 picture mars76  路  3Comments

RyanCCollins picture RyanCCollins  路  3Comments

Primajin picture Primajin  路  4Comments

DanielBaird picture DanielBaird  路  3Comments