New-UDInput Endpoint

Hi there,

maybe someone can explain me, what I’m doing wrong here. both snippets look the same, behave the same but only the second one works :thinking:

 New-UDInput -Title "Enter Computername: " -Id "Form" -FontColor "#FFFFFF" -BackgroundColor "#FF333333" -Content {
        New-UDInputField -Type 'textbox' -Name 'Computername' -Placeholder 'Hostname:' 
    } -Endpoint {
        param($Computername)
        New-UDInputAction -Toast $Computername
}

New-UDInput -Title "Enter Computername: " -FontColor "#FFFFFF" -BackgroundColor "#FF333333" -Endpoint {
        param($CName)
        New-UDInputAction -Toast $CName
}

*edit -> readablility

ok, I spent some time on finding the prob.

if i do it like this:

$db = New-UDDashboard -Content {

New-UDInput -Title "Enter Computername: " -Id "Form" -FontColor "#FFFFFF" -BackgroundColor "#FF333333" -Content {
        New-UDInputField -Type 'textbox' -Name 'Computername' -Placeholder 'Hostname:' 
    } -Endpoint {
        param($Computername)
        New-UDInputAction -Toast $Computername 
                     
    }
    New-UDInput -Title "Enter Computername: " -FontColor "#FFFFFF" -BackgroundColor "#FF333333" -Endpoint {
        param($CName)
        New-UDInputAction -Toast $CName
    } 

}

it works fine for both Toast. if I do the same thing on a different page using the ‘-pages’ switch in the NewUDDashboard to implement the page …

New-UDPage -Name "Computername:" -Icon plus_circle -Content {
    New-UDInput -Title "Enter Computername: " -Id "Form" -FontColor "#FFFFFF" -BackgroundColor "#FF333333" -Content {
        New-UDInputField -Type 'textbox' -Name 'Computername' -Placeholder 'Hostname:' 
    } -Endpoint {
        param($Computername)
        New-UDInputAction -Toast $Computername 
                     
    }
    New-UDInput -Title "Enter Computername: " -FontColor "#FFFFFF" -BackgroundColor "#FF333333" -Endpoint {
        param($CName)
        New-UDInputAction -Toast $CName
        
    } 
} 

… the first Toast doesn’t work and the second works. now I’m really confused.