I have a user input form and each input is connected to one database that is both read & write since I use an autofill function which wont work without the database being both read and write instead of just write only. The only problem is the user inputs will display the first row of information they are connected to in the database, but I need them to be clear for new input. How do I fix this issue?
Then you should only have Write Only, what do you mean by you have something that demands it to be ready & write? When you have ready & write this will happen. The any other solution would be to code eveything and not using a dataset.
Read and write mode for dataset is intended to be used to fill in new items and edit existing (by using Next/Previous actions). In this mode you can also call for “New” action, to create new item, edit it, and pass data to the collection
Next if you want only to add new data - use write only mode. And, for example, placeholder option for input fields
Yeah I realized I needed to keep it in write only mode. I thought that was why my query on the frontend wasn’t returning the other column items. I am trying to autofill the boxes, but when I call a query on the item I’m looking for it will only return the _id, _owner, _updatedDate, _createdDate for one of the calls and not found for the cassette database. I know the items for exist in that row and are synced to the live database not just the sandbox. My permission for reading the databases is set to anyone as well.
$w(‘#input7’).onChange(() => {
let cassetteID = $w(‘input7’).value;
wixData.query(‘Cassette_Database’)
.eq(‘title’, cassetteID)
.find()
.then((results) => {
if (results.items.length > 0) {
let pillInfo = results.items[0];
let pillID = ‘made it’;
let pillRefills = pillInfo._id;
let pillTotal = pillInfo._id;
console.log(pillID);
//$w(‘#input2’).value = pillID;
//$w(‘#input4’).value = pillRefills;
//$w(‘#input8’).value = pillTotal;
}
console.log('Not found')
})
. **catch** ((error) => {
let errorMsg = error;
console.log(errorMsg);
});
})
$w(‘#input1’).onChange(() => {
let patientID = $w(‘input1’).value;
wixData.query(‘Patient_Info’)
.eq(‘patient_id’, patientID)
.find()
.then((results) => {
if (results.items.length > 0) {
let patientInfo = results.items[0];
let patientName = patientInfo._id;
let patientDOB = patientInfo._updatedDate;
console.log(patientInfo);
$w(‘#input6’).value = patientName;
$w(‘#datePicker2’).value = patientDOB;
}
console.log('Not found')
})
. **catch** ((error) => {
let errorMsg = error;
console.log(errorMsg);
});
})
EDIT Solved: To access data from my collections in the frontend code I had to create .jsw file in backend code that queried the data for me and returned any items found when called