Microsoft.Compute.UserNameTextBox UI element
A text box control with built-in validation for Windows and Linux user names.
UI sample
Schema
{
"name": "element1",
"type": "Microsoft.Compute.UserNameTextBox",
"label": "User name",
"defaultValue": "",
"toolTip": "",
"constraints": {
"required": true,
"regex": "^[a-z0-9A-Z]{1,30}$",
"validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-30 characters long."
},
"osPlatform": "Windows",
"visible": true
}
Sample output
"Example name"
Remarks
- If
constraints.required
is set totrue
, then the text box must have a value to validate successfully. The default value istrue
. osPlatform
must be specified, and can be either Windows or Linux.constraints.regex
is a JavaScript regular expression pattern. If specified, then the text box's value must match the pattern to validate successfully. The default value isnull
.constraints.validationMessage
is a string to display when the text box's value fails the validation specified byconstraints.regex
. If not specified, then the text box's built-in validation messages are used. The default value isnull
.- This element has built-in validation that is based on the value specified for
osPlatform
. The built-in validation can be used with a custom regular expression. If a value forconstraints.regex
is specified, then both the built-in and custom validations are triggered.
Next steps
- For an introduction to creating UI definitions, see Getting started with CreateUiDefinition.
- For a description of common properties in UI elements, see CreateUiDefinition elements.