vuetify: [Bug Report] Combobox value not updated when submit directly from field

Versions and Environment

Vuetify: 1.0.4 Vue: 2.5.13 Browsers: Chrome 64.0.3282.186 OS: Mac OS 10.12.6

Steps to reproduce

  • Enter the String “test” into the Combobox
  • Click the submit button (no blur before)

Expected Behavior

The output of latestSubmit should contain the string “test”

Actual Behavior

The output in latestSubmit is empty and only contains the value when clicking a second time.

Reproduction Link

https://codepen.io/dmnk_bln/pen/eVQVZq?editors=1111

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 6
  • Comments: 17 (4 by maintainers)

Most upvoted comments

We kindly ask users to not comment on closed/resolved issues. If you believe that this issue has not been correctly resolved, please create a new issue showing the regression or reach out to us in our Discord community.

Thank you for your contribution and interest in improving Vuetify.

I found another solution

<v-combobox
    v-model="value"
    @input.native="e => value = e.target.value"
></v-combobox>

Solution that works the best:

<v-combobox
  :items="brands"
  label="Brand"
  v-model="brand"
  ref="brandCombobox"
></v-combobox>

submit() {
  this.$refs.brandCombobox.blur();
  this.$nextTick(() => {
      //api call
  });
}

I deal with it by adding this line at top of submit function & making it async:

// waiting for combobox to update before firing
      await new Promise((r) => setTimeout(r, 500));

I handled this by adding a “ref” to the combo box and adding a ref blur event once the submit() method is triggered.

      <v-select
        class="select-field"
        combobox
        :items="items"
        :value="value"
        @input="handleInput"
        ref="myComboBox">
      </v-select>

        handleInput (newData) {
              this.$refs.myComboBox.blur()
              .... existing code w/ ....
              this.$nextTick(() => {
                  .... do stuff that's dependent on the combobox data
              })
        }

`this.$refs.combobox.blur();

let self = this; // Probably you’ll need it to access data inside below callback Vue.nextTick().then(function () { // Submit form… })`

Hope this help @locent217

Oh yeah that definitely worked! Forcing it to blur makes the component react to changes. Nice 😃

@johnleider Hi, i’m issuing this same problem. With the nextTick i can’t solve. Your example (https://codepen.io/johnjleider/pen/VQOVra?editors=1111) doesn’t seem to work when i click Submit before to blur the combobox if i want to submit the current value and not the previous. I tryied also with :search-input.sync=“currentVar” (that updates the value in real time) but in this way i cannot use v-model and when i’m in edit i get an error because field is required and v-model is null.

I think this is a very very common problem (combobox is always used in a v-form so everyone could experiencing this problem when someone click the submit before blurring fields!)

Any suggestions? Thank you!

That is the functionality for v1.1 since v-select will use v-text-field.