All Apps and Add-ons

How can I validate a data input parameter

sporcello
New Member

I am using the Splunk add-on builder, and I am trying to validate the value of a data input parameter when the user enters a value. For example, if the parameter is supposed to be an integer and the user enters a string, I would like to prompt the user and let them know it is an invalid parameter value and needs to be an integer. (Similar to entering a string in the 'Interval' parameter for any new input type as shown in the screenshot).

Edit: Answered my own question... I wasn't able to find this in the add-on builder, however I was able to edit two files in the app that can provide the functionality: /etc/apps//appserver/static/js/build/globalConfig.json and/or /etc/apps//bin/rh.py

Both files allow you edit a "validator" section for the parameters, and allows for configuring a regex pattern for matching and an error message for non-matches. Then when creating a new input in the app, the field value is checked against the regex pattern and if it doesn't match there is a error message like the one in the screenshot below.

alt text

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...