Hello, I have a page with a SUBMIT button at the bottom, which gathers user input and upon clicking the button it saves the data into a collection.
The code at the bottom of the rest of my code is:
export function button6_click(event, $w) {
$w('#button6').disable()
$w("#dataset1").onReady(() => {
var tools = '';
var strategies = '';
for (var t = 0; t <= 14; t++) {
if (selections[t] !== undefined) {
tools += selections[t];
}
}
for (var s = 15; s <= 44; s++) {
if (selections[s] !== undefined) {
strategies += selections[s];
}
}
$w("#dataset1").setFieldValue('digitaltools_pdf', tools);
$w("#dataset1").setFieldValue('strategies_pdf', strategies);
});
}
When I click on the SUBMIT, I get the following errors:
1 - The unknown file failed to upload. Please try again later. undefinedsave operation failed:
2 - DatasetError: Operation cancelled by user code. [object Object]
My questions are:
- what do those errors mean and how can I solve them?
- the line $w('#button6').disable() should grey-out the button, but it doesn't. What is wrong here?
The page is on this site, on the page called "SUBMIT" :
https://editor.wix.com/html/editor/web/renderer/edit/ba7ae0d4-f6da-4057-ac05-eee7e74b5f6f?metaSiteId=99cf63d4-5d5e-4f70-b6ce-d77f8a3b4302&editorSessionId=F33CA352-7FBA-4DD0-B00A-E38E70BCB7AE
Any help would be appreciated. Thank you! :)
Update to code I've tried now:
export function button6_click(event, $w) { $w('#button6').disable().then(() => { $w("#dataset1").onReady(() => { var tools = ''; var strategies = ''; for (var t = 0; t <= 14; t++) { if (selections[t] !== undefined) { tools += selections[t]; } } for (var s = 15; s <= 44; s++) { if (selections[s] !== undefined) { strategies += selections[s]; } } $w("#dataset1").setFieldValue('digitaltools_pdf', tools); $w("#dataset1").setFieldValue('strategies_pdf', strategies); }); }); }
Same errors result..