PPA: User Interface Forms
Minimum PPA Version: 2.11.0
Minimum Plugin Version: 7.0.0
Form Inputs
Version 6.1.0 of this plugin adds support for form inputs in PPA tasks.
Forms can contain as many fields as you need, & multiple field types are supported.
Example
New Joiner Form
The form below contains 3 fields & uses both automatic & custom input validation.
New Joiner Form - PPA Interface
New Joiner Form - Playbook Snippet
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
Using Submitted Data
In this example the following data is submitted using the form.
New Joiner Form - PPA Interface
The joiner_data variable will contain data below:
New Joiner Form - Submitted Data
{
"logon_name": "example.user",
"email_address": "example.user@company.net",
"applications": [
"Outlook",
"Word"
],
"department": "Marketing",
"start_date": {
"timestamp": "2022-03-02T09:00:00+00:00",
"timezone": "Europe/London"
}
}
Its values can then be supplied to any subsequent actions like this:
New Joiner Form - Using Form values
1 2 3 4 5 6 7 |
|
Field Types
The table below shows all supported field types & the validation options for each.
Name | Validation Method | Default Validator | Default Validation Error |
---|---|---|---|
Text | Custom | Any non-blank value | Input must not be blank |
Multi-Line Text | Custom | Any non-blank value | Input must not be blank |
Email Address | Automatic with custom errors | Email address | Invalid email address |
Dropdown | Fixed Format | - | - |
Check List | Fixed Format | - | - |
IPv4 Address | Automatic with custom errors | IPv4 (dot-decimal notation) | Invalid IPv4 address |
Hostname | Automatic with custom errors | RFC-1123 Hostname | Invalid Hostname |
Number | Automatic with custom errors | One or more 0-9 characters | Invalid Number |
Floating Point | Automatic with custom errors | Number with a decimal place | Invalid floating point number |
Date | Fixed Format | DD/MM/YYYY | - |
Date & Time | Fixed Format | DD/MM/YYYY HH:MM:SS | - |
More information on each field type can be found below.
text
Presents a single-line text field.
Supported configuration values:
-
title
-
name
-
default (optional)
-
pattern (optional)
-
pattern_error (optional)
-
required (optional defaulting to true)
Example
1 2 3 4 5 6 7 |
|
Presents an email address field with automatic validation.
Supported configuration values:
-
title
-
name
-
default (optional)
-
pattern_error (optional)
-
required (optional defaulting to true)
Example
1 2 3 |
|
choice
Presents a dropdown box with one or more options.
Supported configuration values:
-
title
-
name
-
options
-
default (optional)
-
required (optional defaulting to true)
Simple List
1 2 3 4 5 6 7 8 |
|
Ordered List With Default
1 2 3 4 5 6 7 8 9 10 11 |
|
checklist
Presents a checklist with one or more options.
Supported configuration values:
-
title
-
name
-
options
-
defaults (optional)
-
required (optional defaulting to true)
Simple List
1 2 3 4 5 6 7 8 9 10 |
|
Ordered List
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
ipv4address
Presents an IPv4 address field with automatic validation.
Supported configuration values:
-
title
-
name
-
default (optional)
-
pattern_error (optional)
-
required (optional defaulting to true)
Example
1 2 3 |
|
hostname
Presents a hostname field with automatic validation.
Supported configuration values:
-
title
-
name
-
default (optional)
-
pattern_error (optional)
-
required (optional defaulting to true)
Example
1 2 3 |
|
multiline
Presents a text field with multiple lines.
Supported configuration values:
-
title
-
name
-
default (optional)
-
pattern (optional)
-
pattern_error (optional)
-
required (optional defaulting to true)
-
lines (optional)
Example
1 2 3 4 |
|
number
Presents a number field with automatic validation.
Supported configuration values:
-
title
-
name
-
default (optional)
-
pattern_error (optional)
-
required (optional defaulting to true)
Example
1 2 3 |
|
float
Presents a floating point number field with automatic validation.
Supported configuration values:
-
title
-
name
-
default (optional)
-
pattern_error (optional)
-
required (optional defaulting to true)
Example
1 2 3 |
|
timestamp
Presents a date & time picker.
Supported configuration values:
-
title
-
name
Example
1 2 3 |
|
date
Presents a date picker.
Supported configuration values:
-
title
-
name
Example
1 2 3 |
|
Input Validation
Depending on the field type, input validation can be automatic or custom.
You can find the validation method for each field here.
The pattern is used to validate the user input, & the pattern_error is displayed to the user if validation fails.
More information on the pattern & pattern_error of each field type can be found here.
Note: validation is not performed on empty fields that are optional.
Custom Validation
By default the text & multiline fields will only validate that the field is not-empty.
You can provide your own validation rules & error messages using pattern & pattern_error.
The following snippet uses both to validate input & present a meaningful error if validation fails:
1 2 3 4 5 6 |
|
Validation Errors
The pattern used by a field with automatic validation cannot be overwritten.
You can still overwrite the pattern_error to control what's displayed if validation fails.
1 2 3 4 |
|
Configuration Glossary
Name | Description | Required | Field Types |
---|---|---|---|
name | The name of the field in the submitted form. | Yes | All |
title | The title of the field in the interface. | Yes | All |
required | Indicates whether the field is required or not (defaults to true). Set to false to make the field optional. | No | text, multiline, email, ipv4_address, hostname, number, float |
pattern | Regular expression used to validate user input. | No | text, multiline |
pattern_error | Error to display if input validation fails. The following field types already show useful errors, but they can be overwritten: email, ipv4_address, hostname, number, float. | No | text, multiline, email, ipv4_address, hostname, number, float |
options | One or more options to select from. | No | choice, checklist |
default | Default value for the field. | No | text, multiline, email, ipv4_address, hostname, number, float, choice |
defaults | One or more default values for the field. | No | checklist |
lines | The default number of lines in the field. | No | multiline |