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 the pre-render gravity form hook to populate list fields

  1. To whom it may concern,

    I am writing PHP code that is hooked to "gform_pre_render" to populate a gravity form with data that I am getting from the database. This data is actually a gravity form entry of a separate gravity form.

    I am finding it difficult to find information on how I can populate list fields.

    I am sure that you are aware of the format in which data is stored for lists. Please use the following as an example "a:2:{i:0;s:6:"Test 1";i:1;s:6:"Test 2";}". Given that I have that raw list data - how can I populate a field list which will reflect it?

    Thank you for all your help and support.

    Kind regards,
    Erika

    Posted 6 years ago on Wednesday March 13, 2013 | Permalink
  2. For a list field, I would use the gform_field_value_$parameter_name filter rather than gform_pre_render:
    http://www.gravityhelp.com/documentation/page/Gform_field_value_$parameter_name

    The last example on that page shows how to populate a list field.

    Posted 6 years ago on Thursday March 14, 2013 | Permalink