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
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.