dimanche 20 octobre 2019

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

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

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?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire