Gform get field value

Description

Use this filter to change the field's value after being retrieved from the database. Use in conjuction with gform_save_field_value to perform low level transformations, such as encrypting/decrypting a field

Usage

<?php
add_filter("gform_get_field_value", "get_field_value", 10, 3);
?>

Parameters

$value
(string) The current entry value to be filtered.
$lead
(Lead Object) The current entry.
$field
(Field Object) The field from which the entry value was submitted.


Examples

This example assumes the field values were base 64 encoded, and decodes them so that they can be properly displayed. View gform_save_field_value for an example on how to encode the fields.

<?php
add_filter("gform_get_field_value", "get_field_value", 10, 3);
function get_field_value($value, $lead, $field){

    //Multi-input fields such as Name and Address will be represented as an array, so each item needs to be decoded individually
    if(is_array($value)){
        foreach($value as $key => $input_value){
            $value[$key] = base64_decode($input_value);
        }
        return $value;
    }

    return base64_decode($value);
}
?>

Source Code

This filter is located in entry_list.php and forms_model.php

Search the Documentation