PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Change hidden field value based on custom validation

  1. I created a custom validation method for a field with the gform_validation filter.
    Is it possible to store some data in a hidden field inside the gform_validation filter?

    add_filter('gform_validation', 'media_custom_validation');
    
    function media_custom_validation($validation_result) {
    
     	global $form_email, $file_id;
    
    	// new gravity form
    	$rg = new RGFormsModel(); 
    
     	// grab the form
            $form = $validation_result["form"];
    
     	// only validate the vault form
      	if ($form['title'] == "Item Support") {
    
    		foreach($form['fields'] as &$field) {
    
    			// store email field in variable
    			if ($field['id'] == "5") {
    						if(true){
    							//success, store data in one of the hidden fields
    						} else {
    
    							//error
    						}
    				}
    
    			}
    
    		}
    	}
        return $validation_result;
    }
    Posted 10 years ago on Tuesday April 30, 2013 | Permalink