I am having a problem that has me stumped. This simple form is not acting as it should. I am trying to add pictures to a database. I have some real-estate properties and each property can have multiple pictures, so I keep the pictures in a separate database.
Below I have written some code… This code should simply grab the property ID from the property chosen in the dropdown menu. It appears to work perfectly. The second I select a property, the ID is displayed in input2.
import wixData from ‘wix-data’;
$w.onReady(function() {
});
export function dropdown1_change(event, $w) {
let dropdownSelPropName = $w(“#dropdown1”).value;
wixData.query(“Properties”)
.eq(“propertyName”, dropdownSelPropName)
.find()
.then((results) => {
let currentID = results.items[0].propKey;
$w(‘#input2’).value = currentID;
});
}
From this point all looks well. I add a name to the Image, choose the file, and hit submit.
For some reason this is the result in the database
The property ID is the last field and it will not populate if the id was generated with the code.
If I manually enter in the property ID it works fine, but for some reason having it coded in there it does not work!
Any suggestions??