### [wpforms_process_validate_number-slider](https://wpforms.com/developers/wpforms_process_validate_number-slider/)

**Published:** September 29, 2026
**Author:** Umair Majeed

**Content:**

## Description

The `wpforms_process_validate_number-slider` action fires validation on the **Number Slider** field when the form is submitted, before any field value is sanitized.

parametertypedescription`$field_id`string|intField ID as a numeric string.`$field_submit`mixedSubmitted field value (raw data). The slider value as posted, before the field casts it to a float.`$form_data`arrayForm data.## More Information

The action fires inside `WPForms_Process::process()`. After the `wpforms_process_before` hooks run, the method loops over every field in `$form_data['fields']` and fires this action once per field with the raw value from `$_POST`. The file lives in `includes/`, so the hook fires in both Lite and Pro. The Number Slider field class also ships in both (`includes/fields/class-number-slider.php`).

This hook is an instance of `do_action( "wpforms_process_validate_{$field_type}", $field_id, $field_submit, $form_data )`. The hook name keeps the hyphen from the field type. The same call fires `wpforms_process_validate_email` for the **Email** field and `wpforms_process_validate_name` for the **Name** field.

The field’s own validation runs on this same action. `WPForms_Field::__construct()` adds each field’s `validate()` method at priority 10 with three arguments. For the Number Slider, that method casts the value to a float, enforces the **Required** setting (a value of 0 counts as filled), and sets the `wpforms_valid_number_label` message when the value is not numeric.

To reject a submission, write a message to `wpforms()->obj( 'process' )->errors[ $form_data['id'] ][ $field_id ]`. Any error set during this loop stops processing before the entry is saved. This runs only on the final submit. On a multi-page form it does not stop the user from moving between pages.

## Source

`wpforms/includes/class-process.php`

## Example

Rejects a Number Slider submission when the selected value is 0, so the user has to move the slider before the form goes through.

```

/**
 * Require a Number Slider value other than 0.
 *
 * @link https://wpforms.com/developers/wpforms_process_validate_number-slider/
 *
 * @param string|int $field_id     Field ID as a numeric string.
 * @param mixed      $field_submit Submitted field value (raw data).
 * @param array      $form_data    Form data.
 */
function wpf_dev_validate_number_slider( $field_id, $field_submit, $form_data ) {

    // Only run on the form with ID 143 and the Number Slider field with ID 1. Remember to change both IDs to match your form.
    if ( absint( $form_data['id'] ) !== 143 || absint( $field_id ) !== 1 ) {
        return;
    }

    if ( (float) $field_submit === 0.0 ) {
        wpforms()->obj( 'process' )->errors[ $form_data['id'] ][ $field_id ] = esc_html__( 'Please select a number that is not 0.', 'wpforms' );
    }
}
add_action( 'wpforms_process_validate_number-slider', 'wpf_dev_validate_number_slider', 10, 3 );
```

## Reference Article

- [Adding Validation to the Number Slider Field (Single Page and Multi Page Forms)](https://wpforms.com/developers/adding-validation-to-the-number-slider-field-single-page-and-multi-page-forms/)

**Categories:** Actions Hooks

---

