Form Input (like ComboBox )

Product: PowerShell Universal
Version: 1.4.6

I’m sorry in advance if I missed this in the forums already, if so point me towards that.

I have searched through the forums, and reviewed the available input types and haven’t found anything that will work yet. I’m looking for how to implement an input on a form that does the following:

  1. Values will be coming from an array
  2. Ability to “Delete” any of the values, and manually enter a new value and have it added to the list.
  3. Values will be passed into the EventData, preferrably as an array if possible.

An example would be:
$IncomingValue = @(“Value A”, “Value B”)

And would show:
Value A [DeleteButton]
Value B [DeleteButton]
[TextBox] [AddButton]

If user clicks on the “Value A” delete button, and enters “Value C” and hits the Add Button, it would then display
Value B [DeleteButton]
Value C [DeleteButton]
[TextBox] [AddButton]

And if submit button is clicked, eventdata would contain IncomingValues=@(“Value B”, “Value C”)

So, I guess it is very similar to the “Transfer List”, but instead of having a predefined list of items to “Transfer”, the items are manually entered by the user.

Thank You - Dave

You could probably cook something up with a UDTextbox and UDButton and store the items in a $Session variable as the user selects them. Then, you could display them in a UDList with a button to remove an item in the list.

When I get some time, I can come up with an example. We don’t have anything specifically built in for this.

Thank you for the direction on this. I’m working on building a function to use it on multiple pages. I have a question about using the “Session” scope. I’m trying to use a dynamic variable name and can’t quite figure out how to do that with the session scope.

An example:
$VariableName = “CB_comboBox1”

$Session:$VariableName = @(“comboboxvalue”,“comboBoxValue2”)

I have tried it that way, I have tried it using set-item, and set-variable. Any idea on how to specify the name of the session scoped variable programatically?

Also - Is there any way, api, etc. to have a value included in the EventData when the Form is submitted?

I think I figured out the Session Variable piece, it looks like my first attempts at using SEt-Item weren’t correct. The following seems to save things to the session scope.

$FullVariableName = “Session:Test”
Set-Item -Path $FullVariableName -Value “D Test”

New-UDTypography -Text “TmpValue: $($Session:Test)”

$tmpValue3 = Get-Item -Path $FullVariableName
New-UDTypography -Text “TmpValue3: $($tmpValue3)”

Any thoughts on getting things included in the EventData on a form Submit?

You won’t be able to include them in the $EventData variable but the session variable should be available in the same event handler so you would need to just access it there.