Contentful logo

Contentful Community

Loading PDF's from a drop down menu


Hello! I’m trying to make a drop down list that will display the names of various forms. I want to be able to load the pdf’s when the name is clicked. Currently, I can tell that the site is aware that there are 4 items in the menu, but it just shows 4 blank spaces. And clicking them does nothing. On the Contentful side, I have a content type called HRForms, with two fields - title, a short text field - and formName, which is a Media type to hold the PDF’s. Here is the code in HTML:

    @foreach (var form in Model)
        <option value ="@form.Title"></option>


Hey @appdev!

If I understood your usecase correctly, media should be created to serve many media files (Many files option when configure the field) and you need to call the entry like this (you can switch to JavaScript to see the snippet).
As for handling/rendering it in HTML, I’m not an expert in HTML but this might help

Let me if that sheds some light. If it doesn’t I’ll try to find a way provide you with more details and some suggestions regarding this.



As far as I know, do the thing like this one requires a hell of a code to write. I can’t do so by myself, to be blunt, but I think you should take a look on the example of the code written for this tool it has this feature you requested as well, but I guess it will take some time to figure something out with this. It’s a paid solution, but you can get some free trial period and go through that code