Gform save field value

m (Examples)
(Description)
Line 1: Line 1:
__NOTOC__
__NOTOC__
== Description ==
== Description ==
-
Use this filter to change the field's value before saving it to the database. Use in conjunction with [[gform_get_input_value]] to perform low level transformations, such as encrypting/decrypting a field
+
Use this filter to change the field's value before saving it to the database. Use in conjunction with [[gform_get_input_value]] to perform low level transformations, such as encrypting/decrypting a field.
== Usage ==
== Usage ==

Revision as of 18:22, 28 November 2011

Description

Use this filter to change the field's value before saving it to the database. Use in conjunction with gform_get_input_value to perform low level transformations, such as encrypting/decrypting a field.

Usage

<?php
add_filter("gform_save_field_value", "save_field_value", 10, 4);
?>

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.
$form
(Form Object) The form from which the entry value was submitted.


Examples

This example base 64 encodes the field values. View gform_get_input_value for an example on how to decode the fields.

<?php
add_filter("gform_save_field_value", "save_field_value", 10, 4);
function save_field_value($value, $lead, $field, $form){

    return base64_encode($value);
}
?>

Source Code

This filter is located in forms_model.php

Search the Documentation