Product: PowerShell Universal
Version: 2.6.2
So using the below code I select a file then enter some text then finish. The final page shows the $Body json fine but $Body.context and $Body.currentStep are empty?? What am I doing wrong??
New-UDDashboard -Title "Hello, World!" -Content {
New-UDStepper -Steps {
New-UDStep -OnLoad {
New-UDElement -tag 'div' -Content { "Select a csv format file containing users to lookup in AD." }
New-UDUpload -Id 'userFile' -Text 'Browse' -Accept '.csv' -OnUpload {
$Session:CSV = Import-CSV $Body.FileName
}
} -Label "Select File"
New-UDStep -OnLoad {
New-UDElement -tag 'div' -Content { "Step 2" }
New-UDElement -tag 'div' -Content { "Previous data: $Body" }
New-UDTextbox -Id 'txtStep2' -Value $EventData.Context.txtStep2
} -Label "Step 2"
} -OnValidateStep {
$Context = $EventData
if ($Context.CurrentStep -eq 0 -and $Context.Context.userFile -eq $null )
{
New-UDValidationResult -ValidationError "No file specified."
}
else
{
New-UDValidationResult -Valid
}
} -OnFinish {
New-UDElement -Tag 'div' -Id 'result' -Content {$Body}
New-UDElement -Tag 'div' -Id 'context' -Content {$Body.context}
New-UDElement -Tag 'div' -Id 'step' -Content {$Body.currentStep}
} -Orientation 'vertical'
}