question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Textarea not setting touched to true when blurred

See original GitHub issue

Has anyone tried a simple textarea field in 6.20? It doesn’t set touched to true like the input field does. It gets set properly when touchAll() is called after a submit but the sync validation errors I’ve set in my form only fire when blurring input fields. I did the following as a little test on the textarea field: … onBlur={() => {console.log(touched)}}

No matter what I do, touched is always false. I’m not sure the syntax for setting touched manually (or touch for that matter). I find the docs to be a little terse and mis-leading at times. I know docs are tough given the constant movement of things.

… Anyhow, I’ve gone through the docs on touch / touched but I’m still a little confused on how to actually use them in my form. Any pointers / examples greatly appreciated.

Dave-o

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

19reactions
joelhangcommented, Nov 29, 2016

I ran into a similar issue. I had to manually set the blur, change and value. It may or may not be related to your issue.

const TextArea = props => {
    return <Field component={renderTextArea} {...props} />
}

const renderTextArea = props => {
    const {
        name,
        input,
        meta: {
            touched, error, warning
        }
    } = props;
    return (
        <textarea
            onBlur={input.onBlur}
            onChange={input.onChange}
            value={input.value}
            name={name}
            />
    );
}
5reactions
gridworkzcommented, Nov 29, 2016

You’re a star, worked like a charm! Thanks so much.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Textarea not setting touched to true when blurred · Issue #2174
It doesn't set touched to true like the input field does. It gets set properly when touchAll() is called after a submit but...
Read more >
HTML input fields does not get focus when clicked
when i click it the field does not get the focus. i can access the field via pressing the "tab-key". It sounds like...
Read more >
Focusing: focus/blur - The Modern JavaScript Tutorial
The blur handler checks if the field has an email entered, and if not – shows an error. The focus handler hides the...
Read more >
Element: blur event - Web APIs | MDN
The blur event fires when an element has lost focus. The event does not bubble, but the related focusout event that follows does...
Read more >
Textarea Tricks | CSS-Tricks
1. Image as textarea background, disappears when text is entered. You can add a background-image to a textarea like you can any other...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found