Pode.Web icon indicating copy to clipboard operation
Pode.Web copied to clipboard

Add support for grouping elements together, for aggregated data sending

Open Badgerati opened this issue 2 years ago • 0 comments

Currently if you were to click a Button - or register and event to an Element - outside of a Form, the only data sent to the Button's scriptblock or event's scriptblock will be just that of the sole Element.

For example: a Button gets clicked but you want the value of some Textbox. Or a event for multiple Radio buttons or Checkboxes to also send the data of the other elements. At the moment, this isn't possible.

The plan is to add a New-PodeWebElementGroup which takes the standard array of -Content. Every Element in this group will be "linked" together, so if it contains a Button and a Textbox then clicking the Button will also serialise the Textbox and forward its value to the Button's scriptblock. Likewise for Events, etc.

ie:

# in this scenario, clicking the button won't be given the textbox's value
New-PodeWebTextbox -Name 'Query'
New-PodeWebButton -Name 'Click' -ScriptBlock {
    # do something
}

# but using the group, clicking the button will now receive the textbox's value
New-PodeWebElementGroup -Content @(
    New-PodeWebTextbox -Name 'Query'
    New-PodeWebButton -Name 'Click' -ScriptBlock {
        # do something
    }
)

Badgerati avatar Apr 25 '23 20:04 Badgerati