Dynamically update New-UDInputField

I’m trying to create a form that will update a list of dropdown lists depending on what is selected in the first dropdown. I currently have it trying to check what the first dropdown, however I’m still really new to Universal Dashboard and only just getting used to Endpoints and the like

This is what I have so far. If anyone has done something similar, or knows what direction I should be looking in that would be fantastic (Please excuse me if the formatting isn’t correct, first time posting any kind of code)(Also please excuse the obfuscated array terms, just staying safe)

$DivisionArray =  @('Financial Control','People & Marketing')

$FinanceArray = @('Financial Control Department 1',
                  'Financial Control Department 2',
                  'Financial Control Department 3')

$MarketingArray = @('People & Marketing' Department 1',
                    'People & Marketing' Department 2',
                    'People & Marketing' Department 3',
                    'People & Marketing' Department 4')

$Dashboard = New-UDDashboard -Title 'New Staff Member' -Content {

    New-UDInput -Title 'New User Information' -Content {
        New-UDInputField -Type textbox -Name "UDFullName" -PlaceHolder "Full Name"
        New-UDInputField -Type textbox -Name "UDPreferredName" -PlaceHolder "Preferred Name"
        New-UDInputField -Type textbox -Name "UDStaffNo" -PlaceHolder "Staff Number"
        New-UDInputField -Type select -Name "UDDivision" -PlaceHolder "Division" -Values $DivisionArray
        If($UDDivision -eq 'Financial Control')
                New-UDInputField -Type select -Name "UDDepartment" -PlaceHolder "Department" -Values $FinanceArray
        If($UDDivision -eq 'People & Marketing')
                New-UDInputField -Type select -Name "UDDepartment" -PlaceHolder "Department" -Values $MarketingArray
        New-UDInputField -Type select -Name "UDManager" -PlaceHolder "Manager" -Values $FinanceManagerArray
        } -Endpoint {
            $UDFullName, $UDPreferredName, $UDStaffNo, $UDDivision, $UDDepartment, $UDManager

            $script:NewStaff   =  [PSCustomObject]@{
                FullName       = $UDFullName
                PreferredName  = $UDPreferredName
                StaffNo        = $UDStaffNo 
                Department     = $UDDepartment
                Division       = $UDDivision
                Manager        = $UDManager

Hello @ollie.g and welcome to the UD forums…personally I would have the dropdown list in one column with an endpoint, then store the selected result as a session variable then pass that session variable to the endpoint which would be located in a different column which would the refresh the other drop downs nested within that column using the autorefresh parameter. I have a blog on UD here https://psdevuk.github.io/ud-flix/ I hope this helps you out.

Correct me if I’m wrong, but wouldn’t require two ‘New-UDInput’ blocks? As they are in different columns?
I hate to ask for handholding like this, but I have not been able to find anything else that is doing something similar ahah

Hey @ollie.g don’t over-complicate things…you could use just https://poshud.com/New-UDSelect for your first drop-down list that stores what has been selected on the OnChange scriptblock parameter, in one column (make sure you store it as a session variable)…after that is selected, you will need to sync-udelement to the other column which is holding the drop-down lists to update… Should be good to go like that :crazy_face:

Man, I’ve been working on this all weekend, cant seem to make it work. :sweat_smile:
Do you have any examples that I might be able to work off?

Yo @ollie.g I know how you feel man, I been working on a new dropzone component, which still isn’t working, and spent hours and hours on it…Anyways, I seen this question asked before, but never yet had the need for this. I know I could do it with the method I mentioned, but even so it would still probably take me a bit of time to fully code it all together. I got 4 kids a wife couple of dogs and a couple of cats, so time is of the essence :crazy_face: I know this is possible, I need to write some new blogs…so might include it on there…