• I would like multiple fields to be changed after the form has been sent. I found this function on their support page:

    <?php
    add_filter("gform_save_field_value", "save_field_value", 10, 4);
    function save_field_value($value, $lead, $field, $form){
            if(absint($form["id"]) <> 94)
                    return $value;
    
            $encode_fields = array(1,2,3);
    
            if(in_array($field["id"],$encode_fields))
                    return base64_encode($value);
            else
                    return $value;
    }
    ?>

    Now assume that I want field ID 1, 2 and 3 to be changed to a value $value1, $value2, $value3 respectively. How do I do this? I tried the following but it didn’t work:

    <?php
    add_filter("gform_save_field_value", "save_field_value", 10, 4);
    function save_field_value($value, $lead, $field, $form){
            if(absint($form["id"]) <> 94)
                    return $value;
    
            $encode_fields = array(1,2,3);
    
            if(in_array($field["id"],$encode_fields))
                    return array($value1, $value2, $value3);
            else
                    return $value;
    }
    ?>

    Hope someone can help, thanks ??

Viewing 1 replies (of 1 total)
  • Moderator Bet Hannon

    (@bethannon1)

    If you use a commercial theme or plugin and need support, please go to their official support channel. In order to be good stewards of the WordPress community, and encourage innovation and progress, we feel it’s important to direct people to those official locations.

    https://www.gravityhelp.com/

    Part of what you pay for when you buy Gravity Forms (or any premium plugin/theme) is support like this. The GF folks are great about answering their tickets and are the best ones to answer these questions.

Viewing 1 replies (of 1 total)
  • The topic ‘Gravity Forms "save_field_value"’ is closed to new replies.