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.

Use gform_pre_submission to combine two fields

  1. Hello,
    I separated the birthday field into two text fields for MailChimp. These fields are: id 83, birth_month_day, and id 81, birthyear.

    Now, i'd like to use the gform_pre_submission hook to automatically show a birthday field that results in 83 plus 81. i.e. field id 85 shows mm/dd/yyyy. I am not a coder, but am making feeble attempts to do this. 2 of 3 forms have these age fields, the form ids are 7 and 11.

    Here is the gform_pre_submission example with my field ids.

    <?php
    add_action("gform_pre_submission", "birthday");
    function birthday(){
        $_POST["input_85"]  = "input_81"&"/"&"input_83";
    }
    ?>

    and—in the new birthday field, id 85, I have populate dynamically with the parameter, birthday. It is returning ) in the birthday field.

    Posted 11 years ago on Wednesday May 29, 2013 | Permalink
  2. I fixed it, It works now. YEA!

    <?php
    add_action("gform_pre_submission", "birthday");
    function birthday(){
        $_POST["input_85"]  = $_POST["input_81"]."/".$_POST["input_83"];
    }
    ?>
    Posted 11 years ago on Thursday May 30, 2013 | Permalink
  3. David Peralty

    Glad you got it to work. All my best!

    Posted 11 years ago on Thursday May 30, 2013 | Permalink