# Show-Input

Shows prompt message box asking user to provide a text string.

## Syntax

Show-Input \[-Prompt] \<String> \[-DefaultValue \<String>] \[-Validation \<String>] \[-ErrorMessage \<String>] \[-MaxLength \<Int32>]

## Detailed Description

Shows prompt message box asking user to provide a text string.

© 2010-2019 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions

## Parameters

### -Prompt \<String>

Prompt message to show in the message box shown to a user.

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | true  |
| Position?                   | 1     |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -DefaultValue \<String>

Default value to be provided for the text box.

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | false |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -Validation \<String>

Regex for value validation. If user enters a value that does not validate - en error message defined with the "ErrorMessage" parameter will be shown and user will be asked to enter the value again.

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | false |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -ErrorMessage \<String>

Error message to show when regex validation fails.

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | false |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

### -MaxLength \<Int32>

Maximum length of the string returned. If user enters a longer value - en error message will be shown and user will be asked to enter the value again.

| Aliases                     |       |
| --------------------------- | ----- |
| Required?                   | false |
| Position?                   | named |
| Default Value               |       |
| Accept Pipeline Input?      | false |
| Accept Wildcard Characters? | false |

## Outputs

The output type is the type of the objects that the cmdlet emits.

* System.String

## Notes

Help Author: Adam Najmanowicz, Michael West

## Examples

### EXAMPLE 1

Requests that the user provides an email, validates it against a regular expression snd whows an allert if the format is not valid

```powershell
PS master:\> Show-Input "Please provide your email" -DefaultValue "my@email.com"  -Validation "^[a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$" -ErrorMessage "Not a proper email!"
```

### EXAMPLE 2

Uses Show-Input command to request user a new name for the content item validating the proper characters are used and assigns the result to $newName variable (nothing gets changed)

```powershell
PS master:\> $contentItem = get-item master:\content
PS master:\> $newName = Show-Input "Please provide the new name for the '$($contentItem.Name)' Item" -DefaultValue $contentItem.Name  -Validation "^[\w\*\$][\w\s\-\$]*(\(\d{1,}\)){0,1}$" -ErrorMessage "Invalid characters in the name"

#print new name
PS master:\> Write-Host "The new name you've chosen is '$($newName)'"
```

### EXAMPLE 3

Requests that the user provides a string of at most 5 characters

```powershell
Show-Input "Please provide 5 characters at most" -MaxLength 5
```

## Related Topics

* [Read-Variable](/appendix/common/read-variable.md)
* [Show-Alert](/appendix/common/show-alert.md)
* [Show-Application](/appendix/common/show-application.md)
* [Show-Confirm](/appendix/common/show-confirm.md)
* [Show-FieldEditor](/appendix/common/show-fieldeditor.md)
* [Show-ListView](/appendix/common/show-listview.md)
* [Show-ModalDialog](/appendix/common/show-modaldialog.md)
* [Show-Result](/appendix/common/show-result.md)
* [Show-YesNoCancel](/appendix/common/show-yesnocancel.md)
* <https://github.com/SitecorePowerShell/Console/>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.sitecorepowershell.com/appendix/common/show-input.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
