PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, January 31, 2022

[FIXED] Laravel 5 : How to get the value on keyup in edit vue js

 January 31, 2022     laravel, laravel-5, vue.js     No comments   

Issue

In our app, we have validation in code.In Edit part, how do I check if the code already exist? when I tried this

Edit vue

<label>Code</label>
<input type="text" class="form-control" name="edit_code" @keyup="checkCOACode"  v-model="coa_code" v-bind:value="chart_of_account_edit.code">

Im encountering this error

conflicts with v-model on the same element because the latter already expands to a value binding internally

EDIT VUE

 props: {
            chart_of_account_edit: '',
        },
checkCOACode(e) {
                e.preventDefault();
                var code = this.coa_code;
                const coa = this.$refs.coaCode
                const coaCode = coa.dataset.table
                alert(coaCode);
                return false;
                axios.post("/checkIfCodeExists", {code:code,table:table})
                    .then((response)  =>  {
                        var code_checker = '';
                        if (response.data == 0) {
                            $('.edit-chart-of-account-finish').removeAttr('disabled','disabled');
                            // code_checker    =   'wala pang ganitong code';
                        }else{
                            $('.edit-chart-of-account-finish').attr('disabled','disabled');
                            code_checker    =   'Code is already exist';
                        }
                        this.coa_checker_result = code_checker;
                    });
            },

Question: How do I get the input value in my code in Edit Part?


Solution

try this.

<input type="text" class="form-control" name="edit_code" @input="checkCOACode"  v-model="coa_code" v-bind:value="chart_of_account_edit.code">

EDIT

<label>Code</label>
<input type="text" class="form-control" name="edit_code" @keyup="checkCOACode"  v-model="coa_code" v-model:value="chart_of_account_edit.code">


Answered By - Doggo
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

1,253,223

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © 2025 PHPFixing