Filter Umbraco Form dropdown list programmatically
I have an Umbraco form. I would like to filter my dropdown list to exclude certain options depending on the logged in user. I know how to perform the filtering. But I don't know how to access the dropdown list so I can perform the filtering. Some of the answers I have seen here are a bit too abstract for me to understand and I am looking for an answer beginner-friendly steps on how to go about this. FYI:
I am clearly lost on how to go about doing this. I just spent the past two hours following this documentation:
Adding a field type to Umbraco Forms. Yes I have learnt a lot (good for me) but the end result isn't what I am trying to achieve.
Following the documentation got me this:
As I said above, what I actually want is to be able to filter a dropdown list on an existing Umbraco form (not create a new answer type or new editor, etc).
So I have had more time to play around, read and think some more. And I am starting to question if it is possible to achieve what I want. Here is my thought process:
The dropdown list is part of the Document Type that my registration document/page is using
But it is actually deeper than that.
Because on the Document Type the form is inserted as a complete Form Component with the dropdown list already in place.
In other words, the dropdown list is not coming from the Document and neither is it coming from the Document Type.
Which left me asking if the Content Service and ContentType Service are any useful for my needs.
I am not sure yet, but my suspicion is that they are both incapable of getting the dropdown list.
Leaving these two services aside, how else can I access the dropdown list?
Is it possible to access it or that's beyond the capability of Umbraco Forms extending?
Filter Umbraco Form dropdown list programmatically
I have an Umbraco form. I would like to filter my dropdown list to exclude certain options depending on the logged in user. I know how to perform the filtering. But I don't know how to access the dropdown list so I can perform the filtering. Some of the answers I have seen here are a bit too abstract for me to understand and I am looking for an answer beginner-friendly steps on how to go about this. FYI:
I am clearly lost on how to go about doing this. I just spent the past two hours following this documentation: Adding a field type to Umbraco Forms. Yes I have learnt a lot (good for me) but the end result isn't what I am trying to achieve.
Following the documentation got me this:
As I said above, what I actually want is to be able to filter a dropdown list on an existing Umbraco form (not create a new answer type or new editor, etc).
So, if anyone has an idea, please help me.
So I have had more time to play around, read and think some more. And I am starting to question if it is possible to achieve what I want. Here is my thought process:
This is where I am now.
is working on a reply...