---
title: How to validate a form field to 1 decimal place?
description: In this example, we are validating a decimal field that starts with 2 digits to 1 decimal place. The valid range is 10.1 to 15.4
---

[Skip to content](https://support.ofsystems.com/how-to-validate-a-form-field-to-1-decimal-place#main-content)

![OFS\_Circle.png\]](https://support.ofsystems.com/hs-fs/hubfs/OFS_Circle.png?height=45&name=OFS_Circle.png)

- [OFS Customer Portal](https://support.ofsystems.com/)
- [Main Website](https://ofsystems.com/)
- [Contact Us](https://www.ofsystems.com/contact-us?)
- [Service Portal](https://ofsystems.atlassian.net/servicedesk/customer/portal/1)

Open main navigation

Close main navigation

- [OFS Customer Portal](https://support.ofsystems.com/)
- [Main Website](https://ofsystems.com/)
- [Contact Us](https://www.ofsystems.com/contact-us?)
- [Service Portal](https://ofsystems.atlassian.net/servicedesk/customer/portal/1)

 Welcome to the OFS Customer Portal

- There are no suggestions because the search field is empty.

1. [OFS Customer Portal](https://support.ofsystems.com/?hsLang=en)
2. [How To Questions](https://support.ofsystems.com/how-to-questions?hsLang=en)
3. [Flow - Validations](https://support.ofsystems.com/how-to-questions?hsLang=en#flow-validations)

# How to validate a form field to 1 decimal place?

## In this example, we are validating a decimal field that starts with 2 digits to 1 decimal place. The valid range is 10.9 to 15.5.

#### **Step 1 — Create the field**

Drag in a decimal field from the left and enter a Unique Field Name.

![](https://support.ofsystems.com/hs-fs/hubfs/image-png-Sep-23-2024-05-42-54-1307-AM.png?width=670&height=271&name=image-png-Sep-23-2024-05-42-54-1307-AM.png)

#### **Step 2 — Set the in-spec range**

In the **Field Validation Rules** tab, create the invalid range for values outside spec — in this example, the field is in-spec between 10.9 and 15.5:

```
(data["decimal"]<=10.9)||(data["decimal"]>=15.5)
```

**![](https://support.ofsystems.com/hs-fs/hubfs/image-png-Sep-23-2024-06-24-20-6552-AM.png?width=670&height=186&name=image-png-Sep-23-2024-06-24-20-6552-AM.png)**

#### **Step 3 — Add the 1-decimal-place format check**

```
data["decimal"]=~"^\\d\\d\\.[0-9]{1}$"
```

This regex:

- `^` asserts the start of the string.
- `\d\d` matches exactly two digits.
- `\.` matches a literal decimal point.
- `[0-9]{1}` matches exactly one digit after the decimal point.
- `$` asserts the end of the string.

Examples of valid strings:

- `12.3`
- `45.7`

Examples of invalid strings:

- `123.4` (has three digits before the period)
- `12.34` (has two digits after the period)
- `1.5` (has only one digit before the period)

**![](https://support.ofsystems.com/hs-fs/hubfs/image-png-Sep-23-2024-06-25-46-3888-AM.png?width=670&height=184&name=image-png-Sep-23-2024-06-25-46-3888-AM.png)**

#### **Step 4 — Add the catch-all invalid rule**

```
1==1
```

![](https://support.ofsystems.com/hs-fs/hubfs/image-png-Sep-23-2024-05-49-45-1386-AM.png?width=479&height=206&name=image-png-Sep-23-2024-05-49-45-1386-AM.png)

---

#### **Adapting it to your own form**

**Validate values 0.09 to 0.13:**

```
data["decimal"]=~"^0\.(09|1[0-2]|13)$"
```

This pattern validates a string starting with `0.` followed by one of `09`, `10`, `11`, `12`, or `13`.

Examples of valid strings:

- `0.09`
- `0.10`
- `0.11`
- `0.12`
- `0.13`

Examples of invalid strings:

- `0.08` (not in the allowed range)
- `0.14` (not in the allowed range)
- `1.09` (does not start with "0.")

- [Getting Started](https://support.ofsystems.com/getting-started?hsLang=en#main-content)

    - [Console: The Basics](https://support.ofsystems.com/getting-started?hsLang=en#console-the-basics)
    - [Analytics: The Basics](https://support.ofsystems.com/getting-started?hsLang=en#analytics-the-basics)
    - [Fusion Manager: The Basics](https://support.ofsystems.com/getting-started?hsLang=en#fusion-manager-the-basics)
    - [OFS-Flow Training : The Basics](https://support.ofsystems.com/getting-started?hsLang=en#ofs-flow-training-the-basics)
    - [OFS-Go](https://support.ofsystems.com/getting-started?hsLang=en#ofs-go)
    - [MayvnAI](https://support.ofsystems.com/getting-started?hsLang=en#mayvnai)
- [Help & Support](https://support.ofsystems.com/help-support?hsLang=en#main-content)

    - [Troubleshooting](https://support.ofsystems.com/help-support?hsLang=en#troubleshooting)
    - [OFS in a Box](https://support.ofsystems.com/help-support?hsLang=en#ofs-in-a-box)
    - [Routers](https://support.ofsystems.com/help-support?hsLang=en#routers)
    - [PLCs](https://support.ofsystems.com/help-support?hsLang=en#plcs)
- [Success with MayvnAI](https://support.ofsystems.com/success-with-mayvnai?hsLang=en)
- [Training Videos](https://support.ofsystems.com/training-videos?hsLang=en#main-content)

    - [Operator Console](https://support.ofsystems.com/training-videos?hsLang=en#operator-console)
    - [OFS Analytics](https://support.ofsystems.com/training-videos?hsLang=en#ofs-analytics)
    - [Fusion-Manager](https://support.ofsystems.com/training-videos?hsLang=en#fusion-manager)
    - [OFS-Flow](https://support.ofsystems.com/training-videos?hsLang=en#ofs-flow)
    - [OFS-Go](https://support.ofsystems.com/training-videos?hsLang=en#ofs-go)
- [How To Questions](https://support.ofsystems.com/how-to-questions?hsLang=en#main-content)

    - [Administration](https://support.ofsystems.com/how-to-questions?hsLang=en#administration)
    - [Operator Console](https://support.ofsystems.com/how-to-questions?hsLang=en#operator-console)
    - [Analytics](https://support.ofsystems.com/how-to-questions?hsLang=en#analytics)
    - [Fusion Manager](https://support.ofsystems.com/how-to-questions?hsLang=en#fusion-manager)
    - [Fusion Manager - Alerts & Services](https://support.ofsystems.com/how-to-questions?hsLang=en#fusion-manager-alerts-services)
    - [Flow](https://support.ofsystems.com/how-to-questions?hsLang=en#flow)
    - [Flow - Validations](https://support.ofsystems.com/how-to-questions?hsLang=en#flow-validations)
    - [Flow - Conditional Expression & Triggers](https://support.ofsystems.com/how-to-questions?hsLang=en#flow-conditional-expression-triggers)
    - [APIs](https://support.ofsystems.com/how-to-questions?hsLang=en#apis)
- [FAQs](https://support.ofsystems.com/faqs?hsLang=en#main-content)

    - [Operator Console](https://support.ofsystems.com/faqs?hsLang=en#operator-console)
    - [Fusion Manager](https://support.ofsystems.com/faqs?hsLang=en#fusion-manager)
    - [Analytics](https://support.ofsystems.com/faqs?hsLang=en#analytics)
    - [OFS-Flow](https://support.ofsystems.com/faqs?hsLang=en#ofs-flow)
- [Case Studies](https://support.ofsystems.com/case-studies?hsLang=en#main-content)

    - [Mavyn AI](https://support.ofsystems.com/case-studies?hsLang=en#mavyn-ai)
- [OFS Guides](https://support.ofsystems.com/ofs-guides?hsLang=en)
- [Webinars](https://support.ofsystems.com/webinars?hsLang=en)

[![](https://support.ofsystems.com/hs-fs/hubfs/Logo%20Medium_no%20words.png?width=128&height=68&name=Logo%20Medium_no%20words.png)](http://ofsystems.com)

Operations Feedback Pty Ltd

7/627 Chapel St, South Yarra, VIC 3123  
+61 3 8684 9859

<https://www.ofsystems.com/> <https://www.linkedin.com/company/operations-feedback-systems/> [mailto:support@ofsystems.com](mailto:support@ofsystems.com)

Copyright © 2025, Operations Feedback Systems Pty Ltd.