(SOLVED) How to Retrieve Document Reference for Selected Item in Dynamic Dropdown

Dear FF Community,

I am in the process of developing a page that enables data entry into the "Items" collection. I want each entry created via this page to be associated with an entry from a collection "Projects." In simpler terms, a user should be able to select a project while creating a new item.

I have implemented a dynamic dropdown with a backend query that fetches a list of documents from a collection and displays their titles in the dropdown. So far, everything is functioning as expected.

However, I'm struggling to understand how to retrieve the document that has been selected in the dropdown. Specifically, I wish to store its Document Reference in the Item entry. Unfortunately, a straightforward approach has proven ineffective. I am unable to access the dropdown's value from the Widget State section, as it appears in red.



I assume this is because the value is merely a string, whereas in my collection I require a field with the datatype Document Reference.

I've attempted to find a workaround, including creating a Page State with the datatype Document Reference, but the result is basically the same.

Any guidance on this matter would be greatly appreciated.

Thank you.

14
33 replies