Say I have a dynamic page with a button that links to a website but then one of my rows doesn't have a website so the column is blank. Can I make that button hidden when the field is blank but keep it shown when there is a link in the field?
Thanks!
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
Hello,
I have been trying to do this same thing. I have been trying for weeks to get it to work, searching up and down the internet. I FINALLY GOT IT TO WORK!! Some Background: What I am doing is I have a job application form on our website that is write only, so someone can fill it out and apply. They can also upload their resume. THEN, I duplicated the entire form on a separate page and made it read only, so our HR department could read through applications on our site, instead of through the backend spreadsheet view.
what I was trying to do is make the "View Uploaded Resume" button disappear if they didn't upload a resume. I have tested this code 6 ways to sunday on almost every browser and it works every time!
My dynamic dataset for this example is called "dynamicDataset"
$w.onReady(function () { $w("#dynamicDataset").onReady(() => { $w("#dynamicDataset").getCurrentItem(); if ($w('#button').link == '') { $w('#button').hide(); } }); });
😁
Search for the word NULL here in the forum and/or the Wix API docs .... that should lead you down the right path ...
https://www.wix.com/code/reference/$w.html
I can show and hide stuff pretty well, but I'm not sure what the code is to know if the field is empty or not?
Can you point out that example?
sure,
through some basic javascript code.
just use the button's hide() method in case the field is empty.
you can look for samples (in the resources section above) that show you how to select an element through code and then hide it.
good luck!