Jump to content

Hide field if image is selected or uploaded


Recommended Posts

Hi everyone. Here's what I'm trying to accomplish:


I've got a Text Frame on a page that pulls in a DealerName varaible. Placed directly on top of that Text Frame, I've got a Graphic Frame that allows the user to either select an image from an image collection gallery, or upload their own image. What I'd like to have happen is to display the DealerName variable only if an image was not selected or uploaded. Otherwise show the image, and not the variable. I've gotten pretty close to making it work, but I can't figure out how to hide the variable if the Graphic Frame contains an image.


I have a feeling this is a pretty basic rule, so I apologize in advance for my noobness. :)

Link to comment
Share on other sites

If the graphic frame is on top of the text frame, then it seems like it should just cover up the text when there's a graphic there. But if that doesn't work, such as if the graphic is partially transparent, then there are a couple of other things you could do.


You could make a simple text rule, something like this:

return Field("GraphicFieldName") ? Field("DealerName") : "";

You can simply name that rule the same as the text field ("DealerName") and it will override the field value, or you can give the rule a different name and use the rule's name in your text frame instead of the data field name.


Or you could add some logic to OnRecordStart to suppress the text frame, like so:

FindTextFrame("Dealer Name Frame").suppress = !!Field("GraphicFieldName");


There are other ways you could accomplish this, but those seem the simplest, at least without seeing the job.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...