Title: Filter Processor would not get $from data
Last modified: September 1, 2016

---

# Filter Processor would not get $from data

 *  Resolved [nicecap](https://wordpress.org/support/users/nicecap/)
 * (@nicecap)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/filter-processor-would-not-get-from-data/)
 * Hey people,
 * I could make an action processor work. But it just won’t work for a pre-process
   filter in order to validate a field on my form.
 * I get into the function however I cannot get the field data. This is my PHP: `
   <?
 * //** checks the lenght of the field VIN – must be exactly 17 characters long **//
   
   function check_vin( $vin ) { if ( strlen( $vin ) == 17 ) { return true; } else{
   return false; } }
 * //** call from the run action processor filter pre processing **//
    add_filter(‘
   caldera_forms_get_form_processors’, ‘slug_custom_validation_register’); function
   slug_custom_validation_register($processors){
 *  $processors[‘slug_custom_validation’] = array(
    “name” => ‘Custom Validation’,“
   pre_processor” => ‘slug_custom_validation_do_validation’, “cf_ver” => ‘1.2.4’);
   return $processors; }
 * //pre-process callback
    function slug_custom_validation_do_validation( $config,
   $form ) {
 *  $value_to_check = ”;
    $data = array();
 *  //MAKE SURE TO SET FIELD ID TO YOUR FIELD ID
    $value_to_check = Caldera_Forms::
   get_field_data( ‘fld_5188483’, $form ); // just for testing I write the value
   into a text file – which works – but $value_to_check is always empty $text = “
   VIN = ” . $value_to_check . “\n”; file_put_contents( “caldera-test.txt”, $text,
   FILE_APPEND );
 *  $is_valid = true;
 *  $file_text = ” im DO: ” . $value_to_check . ” \n”;
 *  file_put_contents( “caldera-test.txt”, $file_text , FILE_APPEND );
 *  //Do your thing to check if is valid and make $is_valid false if not
    if( function_exists(‘
   check_vin’ ) ) { $is_valid = check_vin( $value_to_check ); }
 *  //return an error if not valid, else don’t do anything
    if( ! $is_valid ) { 
   return array( ‘type’ => ‘error’, ‘note’ => __( ‘A valid VIN must be 17 charaters
   long – please check the VIN of your car.’, ‘my-text-domain’ ) ); } } `
 * More or less I took this code from [Caldera Forms Support ](https://calderawp.com/code-snippets/custom-caldera-forms-validation-processor/)
 * In the Caldero Front end I cal the function as a filter processor by **slug_custom_validation_do_validation**
 * The site of concern is: [mycarbio.livedemo.click](http://mycarbio.livedemo.click)
 * Any idea what I’m doin’ wrong?
 * Thank you very much for any help
    Chris
 * [https://wordpress.org/plugins/caldera-forms/](https://wordpress.org/plugins/caldera-forms/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [nicecap](https://wordpress.org/support/users/nicecap/)
 * (@nicecap)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/filter-processor-would-not-get-from-data/#post-7685364)
 * I could resolve the problem.
 * The error was in the processor registration function.
    Not working:
 *     ```
       //** call from the run action processor filter pre processing **//
       add_filter('caldera_forms_get_form_processors', 'slug_custom_validation_register');
       function slug_custom_validation_register($processors){
   
       $processors['slug_custom_validation'] = array(
       "name"	=>	'Custom Validation',
       "pre_processor"	=>	'slug_custom_validation_do_validation',
       "cf_ver" => '1.2.4'
       );
       return $processors;
       }
       ```
   
 * I replaced **$processors[‘slug_custom_validation’]** by **$processors[‘run_action’]**
   and it worked.
 * Working:
 *     ```
       //** call from the run action processor filter pre processing **//
       add_filter('caldera_forms_get_form_processors', 'slug_custom_validation_register');
       function slug_custom_validation_register($processors){
   
       $processors['run_action'] = array(
       "name"	        => 'Custom Validation',
       "pre_processor"	=> 'slug_custom_validation_do_validation',
       "cf_ver"        => '1.2.4'
       );
       return $processors;
       }
       ```
   
 * Chris

Viewing 1 replies (of 1 total)

The topic ‘Filter Processor would not get $from data’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/caldera-forms_475846.svg)
 * [Caldera Forms - More Than Contact Forms](https://wordpress.org/plugins/caldera-forms/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/caldera-forms/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/caldera-forms/)
 * [Active Topics](https://wordpress.org/support/plugin/caldera-forms/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/caldera-forms/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/caldera-forms/reviews/)

## Tags

 * [caldera](https://wordpress.org/support/topic-tag/caldera/)
 * [filter](https://wordpress.org/support/topic-tag/filter/)
 * [forms](https://wordpress.org/support/topic-tag/forms/)
 * [processor](https://wordpress.org/support/topic-tag/processor/)
 * [validation](https://wordpress.org/support/topic-tag/validation/)

 * 1 reply
 * 1 participant
 * Last reply from: [nicecap](https://wordpress.org/support/users/nicecap/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/filter-processor-would-not-get-from-data/#post-7685364)
 * Status: resolved