Import existing data from a pre-filled form - VueJS - Bootstrap-Vue

I'm facing an issue with a form that has linked selects. When one select is filled, the other select should also be filled with the corresponding code. However, when opening the modal with the field value, it fails to load the value. I suspect this might be due to the v-model being used differently.

Template

<template>
    <div class="Data">
        <b-row class="mt-0 mb-0">
            <b-col align="left" md="3" sm="12">
                <b-button variant="primary" @click="viewModal()" class="mr-2" size="sm">
                    <span> New</span>
                </b-button>
            </b-col>
        </b-row>

        // More template code goes here...

        </div>
    </div>
</template>
    
// Script and style sections are included in the original content.

<p>When clicking the "Edit" button in the table's "Actions" column, the values within each "v-model" should be loaded into the opened modal. However, this doesn't happen for the first and second <code>b-form-select elements. On the contrary, adding a new form works flawlessly, automatically populating the second select upon making the first selection.

The issue seems to stem from using different v-models for the top two selects compared to the bottom two selects. The latter correctly populate with data from the dataUnique object as intended.

<b-form-select 
    v-model="dataSelect"
    size="sm">
    <option :key="obj.value2" v-for="obj in informations" v-bind:value="obj">{{ obj.value1 }}</option>
</b-form-select>

Answer №1

The data selection is not being refreshed. Make sure to include the update in your loadUniqueData function.

loadUniqueData(dataUnique) { 
    this.dataUnique = { ...dataUnique } 
    this.dataSelect = { ...dataUnique.dataSelect } 
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to implement date range filtering in vue js?

Currently, I am delving into the realm of vue.js and experimenting with a filtering feature that involves date ranges. The process goes like this: initially filter by type, then proceed to filter by a specified date range, consisting of start and end dat ...

Create a data attribute object and assign to it the prop object received from the parent component

I am struggling with passing an object as a prop from a parent component and then utilizing it to initialize the child component with the received value. The main objective behind this is to create a dialog box that includes a child form component with mu ...

Futuristic routing in VueJS

I've been attempting to dynamically generate routes, but unfortunately I'm facing difficulties as it seems not feasible with Vuejs 3 import { createRouter, createWebHistory } from "vue-router"; import TopMenu from "../layouts/top-m ...

What is the best way to update datatables in Laravel vuejs with fresh data?

Currently, I am utilizing datatables 1.10.19 within vue js and encountering an issue with refreshing the table post inserting new data into the database. Despite trying methods like clear, destroy, and draw, none seem to be effective in achieving the des ...

Changing the way users are linked in a post using HTML tags (VUE-NODE)

I am trying to modify a body property that includes usernames @username1 and @username2. Is it feasible to use regex to transform these nicknames into router links? The desired output should be like this (with the @ removed in the link profile) <router ...

Generate random floating numbers at intervals and calculate their sum

I've been given a task to complete. Upon page load, there should be 10 fields labeled as A, B, C, D ... each with the initial value of 3. After the page has loaded, every 2 seconds all field values should change randomly. The change will be a rand ...

Using surge.sh to deploy a Vue project

All day I've been attempting to deploy my Vue project on Surge.sh. The project is built using the webpack-simple template. Strangely, manual deployment from my CLI works fine. However, when I push it to GitHub and try deploying it from Travis CI, it ...

Dealing with models in Vue.js is proving to be quite a challenge

Why isn't myGame showing as 超級馬力歐 initially and changing when the button is pressed? It just displays {{myGame}} instead. I'm not sure how to fix it, thank you! let myApp = new vue({ el:'myApp', data:{ myGame:&a ...

Set addition fails to trigger computed property

Disclaimer: I'm new to JavaScript I attempted to track all current errors within a component in the following manner, but I seem to be missing something. My error set is updated whenever the username changes, therefore, my computed property displayEr ...

Using the Fetch API to set variables in Vue 2: Asynchronous Task

As someone who is new to working with async tasks, I'm having trouble understanding why my fetch API call isn't updating my Vue variable even though the data appears correctly in the console log. I've tried using Async/Await without success. ...

Oops! It seems like there was a mistake. The ReferenceError is saying that Vue is

I've been working on creating a new app, but I keep running into an issue. Unidentified Reference Error: Vue is not recognized. <template> <v-app> <div id="example-1"> <v-btn v-on:click="counter += 1">Add 1</v-bt ...

Encountering errors when integrating vue-social-sharing with vuetify

Implementing vue-social-sharing in my vuetify project has caused an error when trying to use it inside a modal popup. In my main.js file, I have the following code: import SocialSharing from 'vue-social-sharing'; Vue.use(SocialSharing); The mo ...

Storing various data entries within a MySQL database through the use of Vuex

I am currently facing an issue with inserting multiple data into my database using Vuex. Despite only inserting two data points, I keep getting the error message: COLUMN DOESN'T MATCH VALUE COUNT AT ROW 1. https://i.stack.imgur.com/qBcvK.png Below i ...

Elements with absolute positioning are preventing drag events from executing

Struggling to create a slider and encountering an issue. The problem lies in absolute items blocking slider drag events. I need a solution that allows dragging the underlying image through absolute positioned items. Any ideas on how to achieve this? MANY T ...

Is there a compatibility issue between Vue particles and my project?

Greetings to all! I recently added Vue Particle to my Vue project, but encountered an issue while importing VueParticles in the Main.js file. Here is a snapshot from my terminal for reference. https://i.stack.imgur.com/Bxh2r.png ...

Having trouble getting Vue.js to cooperate with a brand new Laravel 5.8 setup?

I set up a fresh Laravel project using laravel new sample. Then I executed npm install followed by npm run dev. Next, I modified the welcome.blade.php file as shown below: <!DOCTYPE html> <html> <head> <script type="text/j ...

Eliminating Unnecessary Stylesheets in Vite and Vue Website

When working on the Vite-Vue application, I noticed that the styles I implemented for both index.html and Vue components/views are showing up as crossed out in the browser. Additionally, many of the styles I added to the components/views are also being cro ...

Obtaining the heatmapInstance in heatmap-vue: A Step-by-Step Guide

I am currently utilizing the Vue-Wrapper for heatmap.js, which can be found at this link. However, I am encountering an issue where I am unable to call the heatmapInstance "h337" in my Vue-Component. While I can utilize the functionality, I am struggling w ...

Enhance accessibility: Improving screen reader and tab focus behavior with vue-router

It seems that focus resetting and screen readers detecting route changes are not integrated into vue-router. I understand why Vue might have omitted this feature, considering the varying use cases, but I am surprised by the lack of information on accessib ...

I am looking for a way to write a function that will emit an event to the parent component when an icon is

I am creating an input element with an icon to show/hide the password. How can I emit an event in the v-icon to notify the parent component when the icon is clicked? Here is my child component BaseInputPassword: <div class="label"> ...