# Prevent form submission based on entered field values

{% hint style="info" %}
The below action hook only works with Super Forms **v6.3.708+**
{% endhint %}

```php
add_action('super_before_processing_data', function($atts){
  $data = $atts['atts']['data'];
  // Return fake message when one of the following fields matches the value
  $checks = array(
    'email' => array(
      'bot@bot.com',
      'bot2@bot.com',
      'bot3@bot.com',
    ),
    'phonenumber' => array(
      '1231231231',
      '1231231232',
      '1231231233',
    ),
    'my_field_name' => array(
      'value_to_compare_with',
      'value_to_compare_with2',
      'value_to_compare_with3',
    )
  );
  foreach($checks as $fieldName => $compare){
    // Skip if field with this name does not exists in the form
    if(!isset($data[$fieldName])) continue; 
    // Compare the entered value in the form with the one we defined
    if(in_array(trim($data[$fieldName]['value']), $compare)) {
      SUPER_Common::output_message(array(
        'error'=>false,
        'msg' => '<h1>Thank you!</h1>We will reply within 24 hours (fake message to pretent succesful submission, but nothing really happened)'
      ));
    }
  }
});
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.super-forms.com/developers/code-examples/prevent-form-submission-based-on-entered-field-values.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
