Hello Corvid Ninjas, I have a button on my dynamic page, I want to enable this button depending if a checkbox in my database is checked- Basically, I have a school portal using a dynamic page, depending on the school I want to enable or disable the enroll button-
Hi
You can do so by checking if the field is checked or not.
$w.onReady(()=> {
$w('#dynamicDataset').onReady(() => {
let item = $w('#dynamicDataset').getCurrentItem();
if (item.checkBoxField) {
// handle the case where the check-box is checked
$w('#buttonToBeEnabled').enable();
} else {
// handle the case where the check-box is checked
$w('#buttonToBeEnabled').disable();
}
})
})
What you need to change:
-
Dynamic Dataset ID: Replace the Orange text with your dataset ID.
-
The Boolean field key in your collection: Replace the blue key with yours.
-
The Button ID: Replace the brown ID with your button ID.
Hope this helps~!
Ahmad
WOW --THANKS A BUNCH , THIS FORUM IS AMAZING…am trying it now…
You’re welcome Let me know if it worked.
Thanks Ahmad-- It worked like magic…
That’s great! You’re welcome.
You can follow and tag me in the forum whenever you need help, and I’ll help as much as I can.
Followed…Thanks
Hi there its not working for me? It keeps saying:
TypeError: $w(…).onReady is not a function … Line 2
How can i fix this?
Dynamic Dataset ID: Replace the Orange text with your dataset ID.