You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Do you have any possibility to check for a field to be pristine/touched? #21
Create your own <Input /> tag which behaves like this. This is the normal way of handling such a situation in the way needed for you.
For the start copy Input implementation from tags.jsx. Then change the way how it handles the validation error which is enclosed in the link. There is no magic at all, the creation of your own controls is straightforward:
Your Input must know whenever it's focused or touched and suppress displaying the validation error if it's not. Probably, you will need to add the local state to it to make it remember such a thing.
You're supposed to create your own controls wrapping all necessary styles and handling error formatting, in the way that your forms will be defined with the semantic markup. That's an overall idea and links makes it practically possible. tags.jsx is just an example and the starting boilerplate.
OK, thanks I'll try it :-)
Yesterday I „solved“ it using onBlur={() => this.setState({titleTouched: true})} but having more local state in a subcomponent did not feel right.
Yesterday I „solved“ it using onBlur={() => this.setState({titleTouched: true})} but having more local state in a subcomponent did not feel right.
It is okay. You need to hide this local state in <Input/> itself once and forget about it. This state is entirely private and there is no reason to expose it outside.
Activity
gaperton commentedon Apr 20, 2017
Create your own
<Input />tag which behaves like this. This is the normal way of handling such a situation in the way needed for you.For the start copy Input implementation from tags.jsx. Then change the way how it handles the validation error which is enclosed in the link. There is no magic at all, the creation of your own controls is straightforward:
https://github.com/Volicon/NestedLink/blob/master/tags.jsx#L35
Your Input must know whenever it's focused or touched and suppress displaying the validation error if it's not. Probably, you will need to add the local state to it to make it remember such a thing.
gaperton commentedon Apr 20, 2017
You're supposed to create your own controls wrapping all necessary styles and handling error formatting, in the way that your forms will be defined with the semantic markup. That's an overall idea and links makes it practically possible.
tags.jsxis just an example and the starting boilerplate.That's how it is done in userslist example:
https://github.com/Volicon/NestedLink/blob/master/example/src/userslist.jsx#L150
You need to do the same thing but use raw
<input/>and add the local state to make it remember whenever it was touched. That's it.ckpinguin commentedon Apr 21, 2017
OK, thanks I'll try it :-)
Yesterday I „solved“ it using
onBlur={() => this.setState({titleTouched: true})}but having more local state in a subcomponent did not feel right.gaperton commentedon Apr 21, 2017
It is okay. You need to hide this local state in
<Input/>itself once and forget about it. This state is entirely private and there is no reason to expose it outside.