Validators

The function may specify one or more validators for a setting. The client should use these validators to perform front-end validation through the preferred implementation methods.

The function may represent each validator as either a string or a hash.

When the function represents the validator as a string, no arguments exist for the validator.

When the function represents the validator as a hash, the WHM API may also include an argument for the validator.

Validator

Validator description

Argument description

Example

path

Instructs the client to verify that the user's input is a valid path.

(none)

path

startsWith

Instructs the client to verify that the user's input begins with the pattern that the argument specifies.

A string that represents a regular expression to apply against the user input.

{ name: 'startsWith', arg: '[Ee]xample' }

Note:

This example is JSON-encoded, to illustrate the validator's structure.

honeypotAccessKey

Instructs the client to verify that the user's input fits the constraints of an Http:BL API access key.

(none)

honeypotAccessKey

positiveInteger

Instructs the client to verify that the user's input is a positive integer.

(none)

positiveInteger

Radio options

Click to view...

The function only returns this data if the setting's value for the type parameter is radio. The function returns this information as a set of hashes within the radio_options array.

Each hash contains the following returns:

Return

Type

Description

Possible values

Example

option

string

The setting name that the WHM API uses to select the setting's state.

Note:

The string that the option key returns is identical to the string that the client sends in the state field when users select this option. In most cases, do not display this value to the user. Instead, display the name value.

A valid string.

On

name

string

The setting name to display to the user. The user's locale may translate this value.

cPanel, WebHost Manager, and WHM are registered trademarks of cPanel, Inc. for providing its computer software that facilitates the management and configuration of Internet web servers. ®2018 All rights reserved.