New-UDInput Question

Does anyone know if it is possible to have New-UDInputField offer a selection of sub-categories based on the answer to another New-UDInputField?

Does that question even make sense?

maybe there are more elegant solutions for this, but you can work with redirecting to other pages, based on a selection:

Get-UDDashboard | where{$_.Port -eq 1234} | Stop-UDDashboard

$pages = @()
$pages += New-UDPage -Name input1 -Content {
    New-UDInput -Title "Simple Form" -Id "Form" -Content {
        New-UDInputField -Type 'select' -Name 'FavoriteLanguage' -Placeholder 'Favorite Programming Language' -Values @("PowerShell","Python")
    } -Endpoint {
        param($FavoriteLanguage)
        if($FavoriteLanguage -eq "PowerShell"){
            New-UDInputAction -RedirectUrl "/PowerShell"
        }
        else{
            New-UDInputAction -RedirectUrl "/Python"
        }
    }
}

$pages += New-UDPage -Url '/PowerShell' -Endpoint{
    New-UDCard -Title "page: Powershell"
    New-UDInput -Title "Simple Form" -Id "Form" -Content {
        New-UDInputField -Type 'checkbox' -Name 'Newsletter' -Placeholder 'Sign up for Powershell newsletter'
    } -Endpoint {
        param($Newsletter)
    }
}

$pages += New-UDPage -Url '/Python' -Endpoint{
    New-UDCard -Title "page: Python"
    New-UDInput -Title "Simple Form" -Id "Form" -Content {
        New-UDInputField -Type 'checkbox' -Name 'Newsletter' -Placeholder 'Sign up for Python newsletter'
    } -Endpoint {
        param($Newsletter)
    }
}

$d = New-UDDashboard -Title inputtest -Pages $pages
Start-UDDashboard -Dashboard $d -Port 1234
1 Like