Adding a conditional link to a text element

Pieced together this hack from a couple of tips I’ve seen around here.

Case is that I have a comment chain and I want to add the ability to attach an image to a comment. Trying to keep the comments as compact as possible and also I don’t want any mention of an image to show up if there’s no image.

So this is what it looks like now. If a comment has an attached image then the “image” link will appear at the end of the comment

This requires creating an invisible input element, because the text element can include the value of the input element via an expression and the value of the input element can be conditional.

So the input is in the cell and invisible and its initial content is empty. A condition is added that changes the initial content if that cell’s comment has an image

Then the text element, which is visible, has a second expression which grabs the initial content of the invisible input element. So if there’s no image, it will add nothing, but if there is an image, it will add a clickable link.

2 Likes