I’ve been asked to create a channel to link to reports which will either be a local file or an external URL.
I can see an easy way to achieve this - add two non mandatory fields, one for the URL and one for the file, and use an if/else statement in the template to populate the href attribute of the anchor tag.
The problem is that this is less than bulletproof - someone could fill out both fields which would cause a few problems, or become a little confused about what is required. Or they could just add the title and link to nothing, since that would be the only required field.
What I’d like to do is have a dropdown which requires content editors to choose whether they’re linking to a file or a URL. Both the URL field and the file upload field will be disabled initially, but the relevant field will become active and mandatory depending on which of the options has been selected.
Is this possible?