-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot override onReset method of DateInput component #1002
Comments
Hello, I see that the pull request #1032 provides a solution by making the component call the onChange method and return null when the reset button is clicked on. I wonder if it would not be better to declare an onReset function prop that the developer could override. Currently, clicking on the reset button makes the viewValue become "jj/mm/aaaa" which is not always the result the developer wants. To provide some context, I use this component in a bigger form that has a "reset" button to reinit all form components. Due to the current behaviour of this component, our reset button does not work anymore, and clicking on the reset button of the component makes "jj/mm/aaaa" appear, but we would like to display the current date instead. Maybe it would be better to allow the developer to provide an onReset prop and to control the viewValue directly ? |
We implemented this way in order to be compliant with the previous version. But your solution was one of the solutions we had in mind. What do you think @arnaudforaison @johnmeunier ? |
@arnaudforaison @johnmeunier que pensez-vous du message de @lilian-delouvy ? |
We need to discuss this further to see which solution we would implement. |
I managed to do it by settings the onInput event : |
Cannot override onReset method of DateInput component
Toolkit version : 2.0.0
Expected
The onReset method of DateInput should be either available to override, or should return the current day value and not display "jj/mm/aaaa".
Actual
It is impossible to override this method, and when you click on the reset button, no value is returned to the parent component, hence it is impossible to know when the user clicked on this button.
The text was updated successfully, but these errors were encountered: