I have the following code:
export function button6_click(event, $w) {
$w("#button6").disable()
console.log("Button disabled");
$w("#dataset1").onReady(() => {...}
Everything in the onReady(() works, but the .disable() or console.log() don't work. Why?
The page is at the page 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
Hey,
Yeah I found it eventually :)
Note that the disable function returns a promise, so the code should be modified accordingly:
export function button6_click(event, $w) { $w('#button6').disable().then(() => { //The rest of your code }); }
I recommend also reading this article to better understand the subject.
Best,
Tal.
same here.. any ideas?
Hi Tal,
Thanks for the help and the links. I read through the link on Promises, and it's complicated but I think I understand a bit better now.
The current issue is that button6 doesn't become "grayed out" when the disable function executes. I want it to become grayed out when a person clicks on it. Do you know if this is possible...?
My code at the moment is below, given that I want to gray out the button and then send all the info gathered on the page (so I'm not including any other code inside the disable function).
export function button6_click(event, $w) { $w('#button6').disable().then(() => { console.log("Element now disabled"); }) $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); }); }
The console.log message in the disable function gets displayed when the button is clicked, but it doesn't gray-out.
Any ideas on why that is...?
Thanks
Hi Tal,
The page in question is called 'SUBMIT'. Are you sure you checked there? Everything is still the same...
I'm attaching an image to help describe the issue.
Hi Yafim,
I've accessed your editor and couldn't find this function. Have you changed the button name? Have you managed to resolve the issue?
Thanks,
Tal.