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.

Can't type in b-form-textarea

See original GitHub issue

I’m trying to use textarea in my component, but I can’t type in text. Sometimes I was able to type one letter but nothing more. The same code but with b-form-input -works. I can type a text there but in textarea - can’t

I’m using textarea in tabs:

<b-tab v-for="(item, index) in newItem" :key="item.code" :title="item.name" :active="!index">
<!--Input works-->
    <b-form-input id="InfoInput"
          type="text"
          v-model="item.value.info">
     </b-form-input>

 <!--Text area does not work-->
    <b-form-textarea id="countryInfo"
          v-model="item.value.info"
          :rows="3">
     </b-form-textarea>
</b-tab>

OS: Ubuntu 16.4 Browser: Google Chrome Version of Bootstrap-Vue: 2.0.0-rc.2

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:13
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
DavidRuetercommented, Sep 4, 2018

Proposed fix:

In bootstap-vue.js, in the section var bFormTextarea = ... change the following:

on: {
    input: function input(evt) {
        _this.localValue = evt.target.value;
    }
}

Replace with:

on: {
    input: function input(evt) {
        _this.$emit(input', evt.target.value);
        _this.$refs.input.value = evt.target.value;
    }
}

This seems to correct the problem.

Notes:

Nature of the problem is not not being able to type into the textarea because the value is immediately refreshed with the old value. (i.e. the control is not read-only, but flickers and overwrites what you type).

This fix is patterned after the way bFormInput is coded (see onInput() and setValue() methods of bFormInput).

Note that the input event fires on every keystroke.

Before the fix, inspecting evt.target.value shows that the evt.target.value does contain the correct value (i.e. the current value of the text area, including the latest typed character), but the setter on localValue looses the new character that was typed…specifically in vue.js at dep.notify(); in function reactiveSetter() … specifically in vue.js at Dep.prototype.notify = function notify ()...subs[i].update();

After the fix, the control behaves properly.

1reaction
soichihcommented, Jul 31, 2018

I am not sure why this work, but a workaround for me was to initialize the object specified in v-model (in this cacse “info”) through Vue.set(). I think the issue is something to do with the vue observability.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Form Textarea | Components - BootstrapVue
Create multi-line text inputs with support for auto height sizing, minimum and maximum number of rows, and contextual validation states.
Read more >
Customizing a <b-form-textarea> with label and invalid message
First can you tell me where you see the invalidFeedback property. I can't find it in the docs for b-form-input. The label you...
Read more >
Form Textarea | BootstrapVue 3 - cdmoro
Form Textarea. Create multi-line text inputs with support for auto height sizing, minimum and maximum number of rows, and contextual states.
Read more >
The Textarea element - HTML: HyperText Markup Language
This attribute enables you to place <textarea> elements anywhere within a document, not just as descendants of form elements. maxlength. The ...
Read more >
Bootstrap Textarea input free examples, templates & tutorial
A Bootstrap Textarea is an input dedicated to a large volume of text. It may be used in a variety of components like...
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