For the complete documentation index, see llms.txt. This page is also available as Markdown.

New-UDForm

Forms can contain any set of input controls. Each of the controls will report its value back up to the form when the submit button is clicked.

Synopsis

Forms can contain any set of input controls. Each of the controls will report its value back up to the form when the submit button is clicked.

Syntax

New-UDForm [-Id <String>] [-OnValidate <Endpoint>] [-SubmitText <String>] [-CancelText <String>] [-ButtonVariant <String>] [-ClassName <String>] [-DisableSubmitOnEnter] [-Script <String>] [-OutputType <String>] [-ShowBackButton] [<CommonParameters>]

    New-UDForm [-Id <String>] -Children <ScriptBlock> -OnSubmit <Endpoint> [-OnValidate <Endpoint>] [-OnProcessing <ScriptBlock>] [-OnCancel <Endpoint>] [-SubmitText <String>] [-CancelText <String>] [-ButtonVariant <String>] [-ClassName <String>] [-DisableSubmitOnEnter] [<CommonParameters>]

    New-UDForm [-Id <String>] -OnSubmit <Endpoint> [-ButtonVariant <String>] [-ClassName <String>] -Schema <Hashtable> [-UiSchema <Hashtable>] [-FormData <Hashtable>] [-DisableSubmitOnEnter] [<CommonParameters>]

Description

Creates a new form. Forms can contain any set of input controls. Each of the controls will report its value back up to the form when the submit button is clicked.

Parameters

-Id

The ID of the component. It defaults to a random GUID.

Required?                    false
Position?                    named
Default value                [Guid]::NewGuid().ToString()
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false

-Children

Controls that make up this form. This can be any combination of controls. Input controls will report their state to the form.

-OnSubmit

A script block that is execute when the form is submitted. You can return controls from this script block and the form will be replaced by the script block. The $EventData variable will contain a hashtable of all the input fields and their values.

-OnValidate

A script block that validates the form. Return the result of a call to New-UDFormValidationResult.

-OnProcessing

A script block that is called when the form begins processing. The return value of this script block should be a component that displays a loading dialog. The script block will receive the current form data.

-OnCancel

A script block that is called when a form is cancelled. Useful for closing forms in modals.

-SubmitText

Text to show within the submit button. Defaults to 'Submit'.

-CancelText

Text to show within the cancel button. Defaults to 'Cancel'.

-ButtonVariant

Type of button to display. Defaults to text. Valid values are contained, outlined, text.

-ClassName

A CSS class to apply to the form.

-Schema

Defines a form based on a hashtable of schema. This version of forms is based on react-jsonschema-form.

-UiSchema

Used to modify the ordering of the fields (see documentation)

-FormData

-Script

Used to automatically generate forms based on scripts in your PowerShell Universal environment. Script forms will generate input components based on the param block. Script forms automatically support progress and feedback.

-OutputType

The type of output to return from the script. Valid values are: "Text", "Table"

Outputs

-------------------------- EXAMPLE 1 --------------------------

Last updated

Was this helpful?