Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a section on input validation #2265

Merged
merged 5 commits into from
Jul 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions pages/pipelines/input_step.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,22 @@ steps:
value: "stable"
```
{: codeblock-file="pipeline.yml"}

## Input validation

To prevent users from entering invalid text values in input steps (for example, to gather some deployment information), you can use input validation.

If you associate a regular expression to a field, the field outline will turn red when an invalid value is entered.

To do it, use the following sample syntax:

```yml
steps:
- input: "Click me!"
fields:
- text: Must be hexadecimal
key: hex
format: "[0-9a-f]+"
```

The `format` must be a regular expression implicitly anchored to the beginning and end of the input and is functionally equivalent to the [HTML5 pattern attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern).