Skip to main content

New-FluencePrompt

SYNOPSIS​

Builds a single input-prompt specification for Show-FluenceDialog.

SYNTAX​

New-FluencePrompt [-Message] <string> [-Name <string>] [-InputType <string>]
[-DefaultValue <Object>] [-AsPlainText] [-ValidateSet <string[]>] [-As <string>] [-MultiSelect]
[-ValidateNotEmpty] [-ValidatePattern <string>] [-ValidateScript <scriptblock>]

DESCRIPTION​

Returns a Fluence.Prompt object describing one input field: its name (the result key), message, input type, default value, and optional validation rules.

EXAMPLES​

EXAMPLE 1​

New-FluencePrompt -Name User -Message 'Account name' -ValidateNotEmpty

EXAMPLE 2​

New-FluencePrompt -Name Features -Message 'Features' -InputType List -ValidateSet 'Core', 'Docs', 'Samples' -MultiSelect -DefaultValue 'Core'

PARAMETERS​

-As​

For Choice prompts, how to render the set: Combo (default) or Radio.

Type: System.String
DefaultValue: Combo
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-AsPlainText​

Password prompts only. Return a plain string instead of the default SecureString. Assign an explicitly requested plaintext value to a variable to avoid printing it.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-DefaultValue​

The initial value. For a List prompt with -MultiSelect, one item or an array of items. Password defaults must be strings and remain plaintext in the specification; omit the default when collecting a secret. SecureString defaults are rejected without decryption.

Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-InputType​

One of: Text, Multiline, Password, Number, Checkbox, Toggle, Choice, List, Date, Time, FileOpen, FileSave, FolderOpen, Link. Choice renders the -ValidateSet as a combo box or radio buttons; List renders it as a list view that can also take several selections (-MultiSelect).

Type: System.String
DefaultValue: Text
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Message​

The label shown above (or beside) the input control.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-MultiSelect​

For List prompts, allow more than one item to be selected. The captured value is then always an array, even for one selected item. Not valid for other input types.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Name​

The result key under which the captured value is returned. Defaults to an auto name if omitted.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-ValidateNotEmpty​

Require a non-whitespace value (for a List prompt, at least one selected item) before the dialog can close on a non-cancel button. Secure passwords require Length greater than zero.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-ValidatePattern​

A regular expression the value must match. Password prompts require -AsPlainText to use it.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-ValidateScript​

A scriptblock that receives the value and returns $true when valid. On a separate UI runspace it is recreated from text; caller variables, functions and closures are unavailable. Keep validators self-contained. On the caller's STA thread the live block is preserved. Password validators receive SecureString unless -AsPlainText is specified; use Length to check the number of characters. Do not retain or dispose the validator input; the module replaces it as the field changes. Required secure passwords must have at least one character.

Type: System.Management.Automation.ScriptBlock
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-ValidateSet​

For Choice and List prompts, the allowed values. Required when InputType is Choice or List.

Type: System.String[]
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters​

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS​

OUTPUTS​

Fluence.Prompt​

NOTES​

Does not require a host application; this only builds a specification object.