Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

142
Views
Vuejs get edited inputs

Logic

  1. I have checkboxes with inputs as label which values come from database so the text(value) is already exits. (done)
  2. I want to make a list of checked items (done)
  3. I want if I changed an item value get the changed value but it still gives me value of database (need help)

For better understanding here is some screenshots:

1

one

2

two

PS: If I change my input before checking the checkbox my value automatically jumps to default value (DB value)

Code

<template>
    <div class="input-group mb-3 active" v-for="(value, key, index) in list" :key="index">
        <div class="input-group-prepend">
            <div class="input-group-text">
                <input type="checkbox" v-model="checkedFiles" :id="index" :value="value" aria-label="Checkbox for following text input" >
            </div>
        </div>
        <input type="text" :value="value" :id="index" class="form-control" aria-label="Text input with checkbox">
    </div>

    <button class="btn btn-success btn-sm" v-show="isVisible" @click="generate">Generate List</button>
</template>

<script>
    export default {
        name: "directories-component",
        data() {
            return {
                list: [],
                checkedFiles: [],
            }
        },
        methods: {
            getTheList() {
                //....
                this.list = res.data.data;
                //....
            },
            generate(e) {
                e.preventDefault();
                console.log(this.checkedFiles);
            }
        },
        mounted() {
            console.log('Component mounted.')
        }
    }
</script>

Any suggestions?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Use v-model for the input text field

<div class="input-group mb-3 active" v-for="(val, index) in list" :key="index"> // removed key from iterator since list is an array
        <div class="input-group-prepend">
            <div class="input-group-text">
                <input type="checkbox" v-model="checkedFiles[index]" :id="index" aria-label="Checkbox for following text input" > // removed the :value attribute
            </div>
        </div>
        <input type="text" v-model="list[index]" :id="index" class="form-control" aria-label="Text input with checkbox"> // Change added
    </div>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!