Trying to display a text box when a radio button is selected

Was able to get it to work in its most basic form, but its not working in this app. It may have to do with the grid already being rendered, but not sure. Any suggestions would be helpful. Want the textbox to appear to the right of the top radio button (eventually). For now i’m just trying to get it to display.

Below is the code:

New-UDApp -Content { 
    New-UDForm -Content {
    New-UDGrid -Item -Content{
                New-UDRadioGroup -Id 'cag' -Label "Calendar Access" -Children {
                    New-UDRow -Columns {
                        New-UDColumn -ExtraLargeSize 5 -Content {
                            New-UDRadio -Label 'Add Calendar Permissions' -Value 'acp'
                            New-UDRadio -Label 'Update Permissions' -Value 'ccp'       
                        }
                    }
            } -onChange {
                New-UDTextbox -Id 'apr' -Placeholder 'Email of User' -Type "email"
                
            } 
        }} -OnSubmit {
    }
}
Product: PowerShell Universal
Version: 5.2.2

I haven’t tested this code, but I’d probably do it by using a dynamic element.

New-UDApp -Content {
    New-UDForm -Content {
            New-UDGrid -Item -Content{
                  New-UDRadioGroup -Id 'cag' -Label "Calendar Access" -Children {
                     New-UDRow -Columns {
                              New-UDColumn -ExtraLargeSize 5 -Content {
                                    New-UDRadio -Label 'Add Calendar Permissions' -Value 'acp'
                                    New-UDRadio -Label 'Update Permissions' -Value 'ccp'      
                              }
                              New-UDDynamic -Id TextBoxContainer -Content {
                                    if ($Session:RadioSelected) {
                                          New-UDTextbox -Id 'apr' -Placeholder 'Email of User' -Type "email"
                                    }
                              }
                        }
                  } -onChange {
                        $Session:RadioSelected = $True
                        Sync-UDElement TextBoxContainer
                  }
        }
    }
} -OnSubmit {
      # Do Submit
}
2 Likes

This is the way

2 Likes

Looks like that did it! Thanks for the assist.

2 Likes