mdb-select: selected value is not updated when blur event is


Topic: mdb-select: selected value is not updated when blur event is fired

eladhr83 asked 5 years ago

*_Expected behavior_*Get selected value from v-model when blur event is fired:

  1. The user selecting an option from the select
  2. Blur event is fired
  3. The value of v-model is old

*_Actual behavior_*The value that I am getting from the v-model is the old value one when the blur event is fired.

Resources (screenshots, code snippets etc.)\

<template>
    <mdb-select v-model="states" @Blur="onBlur()"></mdb-select>
</template>
<script lang="ts">
    states={text:'France',selected:false,text:'Israel',selected:false}
    onBlur() { 
        // do something like read v-model 
        // and get the old value 
    }
</script>

Magdalena Dembna staff premium answered 5 years ago

The event you should use in this case instead of @blur is @getValue - blur event is fired when the main input loses focus, not when the value gets selected. Kind regards, Magdalena


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB Vue
  • MDB Version: 6.3.0
  • Device: pc
  • Browser: chrome
  • OS: ubuntu
  • Provided sample code: No
  • Provided link: No