WordPress.org

Ready to get started?Download WordPress

Forums

Formidable Forms
Verify field data (2 posts)

  1. torweb
    Member
    Posted 3 years ago #

    Is there a way to verify what is entered in a field against a list of possible answers. I need to find a way to make sure whoever fills out the form has authorization - namely their union card number.

  2. sswells
    Member
    Plugin Author

    Posted 3 years ago #

    Here's some example code to add in a new plugin or your theme functions.php. For more support, please post in the Formidable forums.

    add_filter('frm_validate_field_entry', 'check_for_valid_code', 10, 3);
    
    function check_for_valid_code($errors, $field, $value){
    if($field->id == 20){ //change 20 to the id of the field that should be checked
      $codes = 'enter,your,comma,separated,list,of,codes,here';
      $codes = explode(',',$codes);
      if(!in_array($value, $codes)
        $errors['field'.$field->id] = 'That is not a valid code';
    }
    return $errors;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags