Dialogs

Examples for managing complex interactive dialogs.

Basic text controls

<#
    .SYNOPSIS
        Demonstrates basic text input controls in Read-Variable dialogs.

    .DESCRIPTION
        Shows how to use single-line text, multi-line text, password fields,
        and placeholder text in SPE dialogs.

    .NOTES
        Documentation: https://doc.sitecorepowershell.com
#>

$dialogParams = @{
    Title = "Basic Text Controls"
    Description = "Examples of text input fields available in SPE dialogs."
    Width = 500
    Height = 400
    OkButtonName = "Submit"
    CancelButtonName = "Cancel"
    ShowHints = $true
    Parameters = @(
        @{
            Name = "singleLineText"
            Value = ""
            Title = "Single Line Text"
            Tooltip = "A simple single-line text input"
            Placeholder = "Enter text here..."
        },
        @{
            Name = "multiLineText"
            Value = ""
            Title = "Multi-Line Text"
            Lines = 3
            Tooltip = "A multi-line text area for longer content"
            Placeholder = "Enter multiple lines of text..."
        },
        @{
            Name = "passwordField"
            Value = ""
            Title = "Password"
            Editor = "password"
            Tooltip = "Password input - characters are masked"
            Placeholder = "Enter password..."
        }
    )
}

$result = Read-Variable @dialogParams

if ($result -eq "ok") {
    Write-Host "Single Line Text: $singleLineText" -ForegroundColor Green
    Write-Host "Multi-Line Text: $multiLineText" -ForegroundColor Green
    Write-Host "Password: $passwordField" -ForegroundColor Green
}

Number controls

Checkbox control

Checklist control

Radio button control

Date Time control

Single item picker with a tree

Treelist control

Multilist controls

Droplist contol

Grouped dropdown controls

User role pickers

Rule editor controls

Info display controls

Variable binding

Tabbed dialog

Conditional visibility

Column layout

Mandatory fields

Dialog customization

Simple dialog

Comprehensive example

Last updated