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.

Default form field values

  1. arkmannj
    Member

    Hello,

    I would like to know, if I have say three fields is it possible to make the default value of the third field a combination of the values input into the first two fields?

    Example: Field A = 0123, Field B = 456
    so the dfefault value for Field C would be 0123456.

    Thank you

    Posted 13 years ago on Monday March 26, 2012 | Permalink
  2. arkmannj
    Member

    Anyone?

    Posted 13 years ago on Monday April 2, 2012 | Permalink
  3. What you want to do isn't a built in feature. You want to combine or concatenate the value of two different fields to create the value of a third field. This can only be done using custom PHP and available hooks.

    You would add a Hidden Field to your form to use to store the value of Field C. You would then use custom PHP you add to your themes functions.php that uses the gform_pre_submission hook to get the values of Field A and Field B and combine them and store them as the value of Field C (the hidden field you added to your form).

    Here is a support forum thread that discusses how to do this. Check out the reply by Alex that includes sample code:

    http://www.gravityhelp.com/forums/topic/combining-fields

    You would have to customize the code to suit your specific use case and needs.

    Posted 13 years ago on Monday April 2, 2012 | Permalink