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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...