How to ensure a single line text field in catalog form to only accept numeric values ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2024 10:42 AM
I have 4 single line text fields (A,B,C,D) which in my catalog form (Z) which need to only accept numeric values. How do I achieved this using a regex in a client script and a script include? [Will this regex work -
RegExp('[0-9]+(,[0-9]+)+')]?
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2024 11:04 AM
Since this is a variable in a Catalog Item, you can use Variable Validation Regex without a client script/script include. This it the simplest regex to validate that the value is a number:
^[0-9]*$
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2024 04:55 AM
Hi @Brad Bowman where do I put this and what should be the variable type?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2024 05:22 AM
Variable Validation Regex is on the left nav
The variable type should be Single line text. After you create the validation regex, you can select it for this variable on the Type Specifications tab.