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

web
mobile

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

eladhr83 pro asked 2 months 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 2 months 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.
Status

Answered

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