For the complete documentation index, see llms.txt. This page is also available as Markdown.

Name Field Validation

Validate name fields to prevent spam leads

The Form Guard provides a flexible and powerful name validation component that allows you to configure how Clearout should validate names based on your specific requirements. This section covers the various options available to customize the name validation behavior.

Note: Current Gibberish name detection is based on Markov Chaining detection method and the model has been trained and tested for USA person names. You can control the detection accuracy by Gibberish Threshold option

Name Field Setting Options

Find below the various name field setting options that can be configured as part of the Guard creation or by using the customized code

select and customize Name validation settings for Name Field
Customize how names are validated on your forms.

Acceptable Values

  • Accept any Valid name (default): Allows any name that is properly formatted, contains no profanity, and does not include special characters or numbers

  • Accept only Non-Gibberish names: Allows only names with valid format and non-gibberish characters

  • Custom: Allows you to set your own custom validation rules for names

    • Block Gibberish Names: Block names classified as gibberish by Clearout

    • Block Profanity Words: Prevent submission of names containing profanity or inappropriate language.

    • Block form submission on timeout: Block form submission if the name validation request times out

    • Block form submission on usage limit crossed: Block form submission when name validation usage limit exceeds

Feedback Messages

This option allows you to customize the feedback (error) messages displayed on forms when an invalid or unacceptable value is entered in the name field.

  • Default: A predefined set of feedback messages automatically set by the Form Guard.

  • Custom: Displays all possible feedback message variations for the name field, with their default values shown as placeholder text in the input field.

Hooks

This option allows you to define custom JavaScript functions that execute either before or after Clearout's form validation.

On Before Verify

This hook is triggered just before Clearout's name validation runs. The function receives two destructured parameters as defined below:

  • name: The value entered in the respective form field.

  • $form: The jQuery-wrapped form element.

The function should return an object with is_acceptable and error_msg properties. Setting is_acceptable to false will consider the input value as invalid with the message set on the error_msg property.

  • is_acceptable: The validation status of the On Before Verify hook.

  • error_msg: The HTML error message string to be displayed in case is_acceptable is false.

On After Verify

This hook is triggered just after Clearout's Name validation runs and has returned back with the Clearout's Validation response. The function receives three de-structured params:

  • name: The value entered in the respective form field

  • $form: The jQuery-wrapped form element

  • result: The Clearout's Validation result object

The function should return an object with is_acceptable and error_msg properties. Setting is_acceptable to false will consider the input value as invalid with message set on error_msg property.

  • is_acceptable: The validation status of the On After Verify hook.

  • error_msg: The HTML error message string to be displayed in case of is_acceptable is false.

Field Selection

This option lets you choose whether Clearout's Form Guard should automatically detect and attach validation to name fields or apply validation only to specific fields of your choice.

By default, the Automatic mode is enabled, allowing Clearout to identify form fields based on various techniques:

  • Element's type is of text and name attribute is any one of name, first-name, last-name, first_name, last_name, firstname, lastname, clearout-name

  • Element has attribute data-clearout-name-field

Gibberish Threshold

Defines the sensitivity level for gibberish detection. Possible values: Off, Low, High (default: High). Higher values apply stricter detection criteria.

Optional Fields

In case the name input field is set as optional, without requiring the visitor to fill it, then you can set this option to "Yes."

Here's how it works:

  • If the field is left empty: The form submission will proceed without validation for that field.

  • If the field is filled: Even though it's optional, the entered value will be validated. The form will only be allowed to submit if the value passes validation based on your configured criteria.

Testing

For testing purposes, you can use the following test names to verify different validation scenarios without incurring any credit cost.

Test Name
Gibberish
Clearout Status
Profanity
Description

Elon Musk

false

valid

false

Valid name with proper formatting

Bill Gates

false

valid

false

Valid name with proper formatting

John Doe

false

valid

false

Valid name with proper formatting

James aaa

true

invalid

false

Contains gibberish text

john19890512

true

invalid

false

Completely gibberish text

Mr1 Smith

false

invalid

false

Invalid name with number in title

M~r. Smith

false

invalid

false

Contains special character (~)

asdnaksjfajksfnjaksf

true

valid

false

Gibberish name, keyboard smash

qwertyuiop

true

valid

false

Gibberish name, keyboard smash

Élon Mùsk

false

valid

false

Accented valid name with proper formatting

Ävinfgùelsk

true

valid

false

Accented Gibberish name

asshole

false

valid

true

Profanity word with proper formatting

shit

false

valid

true

Profanity word with proper formatting

Last updated

Was this helpful?