Running into an issue with dashboards where forms created from a JSON Schema are not executing the -OnSubmit block. I have tried my own implementation as well as the example in the documentation and when clicking the submit button nothing happens.
Anyone have any suggestions?
Implementation from Docs
New-UDForm -Schema @{
title = "Test"
type = "object"
properties = @{
hostname = @{
title = "Hostname"
type = "string"
}
ipaddress= @{
title = "IP Address"
type = "string"
format = "ipv4"
}
description = @{
title = "Server Description"
type = "string"
}
servertype = @{
title = "Server Type"
type = "string"
enum = "App","DB"
}
environment = @{
title = "Environment"
type = "string"
enum = "Prod", "Dev" , "QA"
}
}
required = @('hostname','ipaddress','description','servertype','environment')
} -uiSchema @{
"ui:order" = @('environment','hostname','ipaddress','description','servertype')
} -OnSubmit {
Show-UDModal -Content {
New-UDTypography -Text $EventData.formData
} -Footer {
New-UDButton -Text "Close" -OnClick {Hide-UDModal}
} -Persistent
}
type or paste code here
I’m running into the same thing. Were you able to find a solution?
I tried using the below to see if I could enter the debugger to see if it was throwing some kind of silent error. Looks like it’s not executing anything in the block, possibly just moving past it.
New-UDForm -Schema @{
title = "Test"
type = "object"
properties = @{
hostname = @{
title = "Hostname"
type = "string"
}
}
} -OnSubmit {
$testVariable = "On Submit was clicked"
Show-UDToast -Message "Submit was clicked"
Wait-Debugger
}
This is on v4.0.5
Environment is v7.3.5
I did test all of the environments to see if there was something wrong with the environment I was using. Still same issue.
Edit:
Upgraded to v4.0.8 issue still exist.
Performed some more troubleshooting and found errors in the DevTools console of chrome:
Thanks for the update. Tested this on 4.0.9 and the submit button now works, but reading the form data is not working. Tested it with the following code from the documentation and received the following output
New-UDForm -Schema @{
title = "Test"
type = "object"
properties = @{
hostname = @{
title = "Hostname"
type = "string"
}
ipaddress= @{
title = "IP Address"
type = "string"
format = "ipv4"
}
description = @{
title = "Server Description"
type = "string"
}
servertype = @{
title = "Server Type"
type = "string"
enum = "App","DB"
}
environment = @{
title = "Environment"
type = "string"
enum = "Prod", "Dev" , "QA"
}
}
required = @('hostname','ipaddress','description','servertype','environment')
} -uiSchema @{
"ui:order" = @('environment','hostname','ipaddress','servertype','description')
} -OnSubmit {
Show-UDModal -Content {
New-UDTypography -Text $EventData.formData
} -Footer {
New-UDButton -Text "Close" -OnClick {Hide-UDModal}
} -Persistent
}