The data retrieved from the database is inserted into the input fields and submitted as a form. This data is an object that passes the value to the database.
However, when I trigger this form, an error occurs.
See example of the error
<input id="merchantCode" type="text" name="merchantCode" @ionInput="merchantPaymentInfo.merchantCode = $event.target.value;" v-model="merchantPaymentInfo.merchantCode" />
<input id="merchantKey" type="text" name="merchantKey" @ionInput="merchantPaymentInfo.merchantKey = $event.target.value;" @ionChange="merchantPaymentInfo.merchantKey = $event.target.value;" v-model="merchantPaymentInfo.merchantKey" />
<input id="orderRef" type="text" name="orderRef" @ionInput="merchantPaymentInfo.orderRef = $event.target.value;" @ionChange="merchantPaymentInfo.orderRef = $event.target.value;" v-model="merchantPaymentInfo.orderRef" />
<input id="amount" type="text" name="amount" @ionInput="merchantPaymentInfo.amount = $event.target.value;" @ionChange="merchantPaymentInfo.amount = $event.target.value;" v-model="merchantPaymentInfo.amount" />
<input id="refNo" type="text" name="refNo" @ionInput="merchantPaymentInfo.refNo = $event.target.value;" @ionChange="merchantPaymentInfo.refNo = $event.target.value;" v-model="merchantPaymentInfo.refNo" />
<input id="currCode" type="text" name="currCode" @ionInput="merchantPaymentInfo.currCode = $event.target.value;" @ionChange="merchantPaymentInfo.currCode = $event.target.value;" v-model="merchantPaymentInfo.currCode" />
<input id="installmentPeriod" type="text" name="installmentPeriod" @ionInput="merchantPaymentInfo.installmentPeriod = $event.target.value;" @ionChange="merchantPaymentInfo.installmentPeriod = $event.target.value;" v-model="merchantPaymentInfo.installmentPeriod" />
// In Typescript vuejs
async cartMergeRepurchase(data:object){
const res = await CartService.repurchase(data).then(function (response) {
return response;
})
//console.log(res);
let returnData = null;
if(res.data.success)
{
returnData = res.data.returnData;
this.$data.merchantPaymentInfo.merchantUrl = returnData.merchantUrl;
this.$data.merchantPaymentInfo.merchantCode = returnData.merchantCode;
this.$data.merchantPaymentInfo.merchantKey = returnData.merchantKey;
this.$data.merchantPaymentInfo.orderRef = returnData.orderRef;
this.$data.merchantPaymentInfo.amount = returnData.amount;
this.$data.merchantPaymentInfo.refNo = returnData.refNo;
this.$data.merchantPaymentInfo.currCode = returnData.currCode;
this.$data.merchantPaymentInfo.installmentPeriod = returnData.installmentPeriod;
this.$el.querySelector("#merchantCode").value = this.$data.merchantPaymentInfo.merchantCode;
this.$el.querySelector("#merchantKey").value = this.$data.merchantPaymentInfo.merchantKey;
this.$el.querySelector("#orderRef").value = this.$data.merchantPaymentInfo.orderRef;
this.$el.querySelector("#amount").value = this.$data.merchantPaymentInfo.amount;
this.$el.querySelector("#refNo").value = this.$data.merchantPaymentInfo.refNo;
this.$el.querySelector("#currCode").value = this.$data.merchantPaymentInfo.currCode;
this.$el.querySelector("#installmentPeriod").value = this.$data.merchantPaymentInfo.installmentPeriod;
this.$el.querySelector("#ffForm").action = this.$data.merchantPaymentInfo.merchantUrl;
}
//
alert(JSON.stringify(returnData));
(this.$refs['ffForm'] as any).submit();
},
(this.$refs['ffForm'] as any).submit();