Hi! I'm having a problem with inputs values and I see that it already happened to someone else in this forum.
CONTEXT - I have a project where properties are registered and one of the Input fields is the "price" that is saved in the inventory database and also in the sales database as a numeric field.
When a property is sold, the system administrators enter the sales section to fill in the buyer's data, for which the price field is already defined. everything works correctly since it is not a complex code, it is just calling the database with a given reference Id and then pass the data to its respective input fields
$w.onReady(()=>{
$w("#dynamicDataset").onReady(()=>{
getData();
})
})
async function getData(){
let propertyId = await $w("#dynamicDataset").getCurrentItem()._id;
let data = await wixData.query("inventory")
.eq("reference",propertyId )
.find()
let itemData = data.items[0];
$w("#ipPrice).value = itemData.price;
}
PROBLEM: With the code above everything is working correctly and the field is being filled with the correct information let's say for example 800000 The problem is that when the other buyer data is filled in (name, telephone, etc.) and I save the data, the value of the price input comes out empty, since the 800000 initial value is there in the input. 🤔
I notice that this problem happens randomly. Once in a while everything is fine, but most of the time the input value got wiped, I also notice that on mac almost never happens but on windows happens almost all the time, both on chrome browser
export async function BtnSave_click(event){
let dataToUpdate = await wixData.query("inventory")
.eq("reference",propertyId )
.find()
let itemData = dataToUpdate.items[0];
itemData.price = $w("#ipPrice).value; // here the price
input value is empty
even if it has
the 8000000
itemData.name = $w("#ipName).value;
itemData.telephone = $w("#ipTel).value;
wixData.update("inventory",itemData)
.then(()=>{
console.log("data updated")
})
}
I saw another post that has the same problem but no solution :(
https://www.wix.com/velo/forum/coding-with-velo/input-elements-value-wiped-after-page-loading