Hello Tomer,
In the properties panel my Select File button is called ‘Upload’ and the Submit button is called ‘Submit’. Here is the modified code where I inputed all of the new ID’s:
$w('#submit').onClick( () => {
if ($w("#upload").value.length > 0) {
// user chose a file
console.log(`Uploading '${$w("upload").value[0].name}'`);
$w("#upload").startUpload()
.then( (uploadedFile) => {
console.log("Upload successful. File is available here:");
console.log(uploadedFile.url);
$w("#Submit-Organizations").setFieldValue("image", uploadedFile.url);
$w("#Submit-Organizations").save()
.then( (item) => {
console.log("Save successful");
let fieldValue = item.fieldName;
} )
.catch( (err) => {
let errMsg = err;
} );
} )
.catch( (uploadError) => {
console.log(`File upload error: ${uploadError.errorCode}`);
console.log(uploadError.errorDescription);
} );
} else {
// user clicked button but didn't chose a file
console.log("Please choose a file to upload.");
}
} );
And then here are the following errors that I get (which I get normally no matter what code from the Wix documentation I have attempted to use):
There was an error in your script
Error: Can't use $w for selection components before the page is ready
There was an error in your script
Error: Can't use $w for selection components before the page is ready
I really hope the upload button ‘connect to database’ will soon be available,