Hi There,
i am facing a problem i cannot solve; i have a repeater with 3 fields:
- 2 text labels
- 1 image
It is connected to a database of user comments where users can store:
- their name
- their comment
- an image attached to the comment
The repeater of course contains a placeholder image which, after user's submit, shows the image the user has just uploaded and that has been stored in the comments database.
The fact is: some users may want to attach an image, but some user may not... and at the moment, if the user does not load an image, the placeholder is shown.
What i am trying to achieve is that the image is visible in the repeater only IF the it is written in the database, thus being a submitted image and not the placeholder. If the user only adds a text comment, the image placeholder is not shown in the repeater.
Anyone has any idea?
Thank you in advance.
Disconnect the image from the dataset on the editor, and use this code:
$w.onReady(() => { $w("#image1").hide(); $w("#dataset1").onReady(() => { $w("#repeater1").onItemReady(($i, iData) => { if(iData.image){ $i("#image1").src = iData.image; $i("#image1").show(); } }) }) })