Hey!
I stuck with this problem!
In a database a column says 'Pro' and the item value is 'false'. I want to hide an element like a box at the specific item page because the value is false. But if the value is true the box is visible. Does anyone know how to do this in Javascript?
I don't know much about Javascript so I hope you guys can give me a clear explanation.
Thanks in advance!
Quin, on the dynamic page, you need to get the current item from the dataset, first of all, you have to make sure that page and the dataset have finished loading in order for this to work.
$w.onReady( () => { $w('#dataset').onReady(async () => { let item = await $w('#dataset').getCurrentItem(); let memberIsPro = item.pro; if (memberIsPro === true) { $w('#onlyForProBox').show(); } }) })
That's it, and sorry to reply late, I was kind of busy.
Anyways, I hope that helped 😉
Ahmad
Hey Ahmad!
It works! I'm so thankfull. 😍
yes! Thank you!
So, if I understand it correctly, the name of the column in the database is 'memberIsPro' and its type is 'text'. Is that correct?
Hey Ahmad!
Thanks for your response.
It is on a dynamic page. The url is domain.com/studio/{title}.
Can you tell me where are you planing to setup the box? Is it on a dynamic page? If so, what are the page keys that are used to build its URL?
Please give me details so I can help you.
Ahmad.