---
title: "fluentform/validate_input_item_{input_key}"
description: "## Description  This filter validates input items. It is available just before submitting the form. You can do your custom validation and show the error message. If $error is empty then it's valid. Otherwise, you can return the $errorMessage message…"
url: "https://fluentforms.com/docs/fluentform_validate_input_item_input_text/"
updated: "2025-05-12"
category: Filter Hooks
---

# fluentform/validate_input_item_{input_key}

## Description 

This filter validates input items. It is available just before submitting the form. You can do your custom validation and show the error message. If $error is empty then it's valid. Otherwise, you can return the $errorMessage message as a string.

```php
apply_filters('fluentform/validate_input_item_input_text', $errorMessage, $field, $formData, $fields, $form );
```

## Usage  

The following would apply to all forms:

```php
add_filter('fluentform/validate_input_item_input_text', function ($errorMessage, $field, $formData, $fields, $form) {
    $fieldName = $field['name'];
    if (empty($formData[$fieldName])) {
        return $errorMessage;
    }
    $value = $formData[$fieldName]; // This is the user input value

    /*
     * You can validate this value and return $errorMessage
     */

    return [$errorMessage];

}, 10, 5);
```

The following would apply to a specific form id 12:

```php
add_filter('fluentform/validate_input_item_input_text', function ($errorMessage, $field, $formData, $fields, $form) {

    /*
     * Validate only for form id 12
     */
    $targetFormId = 12;
    if ($form->id != $targetFormId) {
        return $errorMessage;
    }

    $fieldName = $field['name'];
    if (empty($formData[$fieldName])) {
        return $errorMessage;
    }
    $value = $formData[$fieldName]; // This is the user input value

    /*
     * You can validate this value and return $errorMessage
     */

    return [$errorMessage];

}, 10, 5);
```

Email confirmation field using email validation filter, check [here](https://fluentforms.com/docs/email-confirmation-field/).

## Parameters 

- **$errorMessage**string
- **$field**(array) **-**Contains the fill field settings
- **$formData**(array)**-**Contains all the user input values as key pair
- **$fields**(array)**-**All fields of the form
- **$form** (Object) The [$form Object](https://fluentforms.com/docs/form-object/)
- **$confirmation** (array)

## Placement

This code should be placed in the [functions.php](http://codex.wordpress.org/Theme_Development#Functions_File) file of your active theme.

## Similar Filter for other input

```php
/*
 * Common Filter hook names
 * Text/Mask: fluentform/validate_input_item_input_text
 * Email: fluentform/validate_input_item_input_email
 * Textarea: fluentform/validate_input_item_textarea
 * Numeric: fluentform/validate_input_item_input_number
 * Range Slider: fluentform/validate_input_item_rangeslider
 * Address: fluentform/validate_input_item_address
 * Country Select: fluentform/validate_input_item_select_country
 * Select: fluentform/validate_input_item_select
 * Radio: fluentform/validate_input_item_input_radio
 * Checkbox: fluentform/validate_input_item_input_checkbox
 * Website URL: fluentform/validate_input_item_input_url
 * Date: fluentform/validate_input_item_input_date
 * Image Upload: fluentform/validate_input_item_input_image
 * File Upload: fluentform/validate_input_item_input_file
 * Phone Field: fluentform/validate_input_item_phone
 * Color Picker: fluentform/validate_input_item_color_picker
 * Net Promoter Score: fluentform/validate_input_item_net_promoter_score
 * Password: fluentform/validate_input_item_input_password
 * Ratings: fluentform/validate_input_item_ratings
 * Repeater: fluentform/validate_input_item_repeater_field
 */
```
