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.

Prepopulating multicolumn list field results in php error, but field is populate

  1. Hi,

    I'm using gravityforms version 1.6.10.

    I'm prepopulating a list field per the example at the bottom of this page: http://gravityhelp.com/documentation/page/Gform_field_value_$parameter_name

    The field is populated properly, but I'm seeing the error "Warning: explode() expects parameter 2 to be string, array given in [...] form_display.php on line 1671."

    If I pass a string instead of an array, there is no error, but the field is not populated correctly.

    If I comment out line 1671 of form_display.php, all is well: no error, field populates properly.

    I don't have that list field set to use conditional logic (line 1671 is inside the get_conditional_logic function).

    I thought maybe one of my array values might have been causing the problem, but passing an empty array (or the array example on the page referenced above) has the same results: php error, but field is populated as expected.

    Any ideas?

    Thanks!
    Teresa (and Peter and Richard)

    Posted 11 years ago on Thursday December 6, 2012 | Permalink
  2. This is a warning, and not an error, which is likely why it works, even when you receive the warning.

    I will bring this to the attention of the development team. Since the php explode function is supposed to be on strings, not arrays, there may be something unique about applying it to the list field. Thank you for posting your findings.

    Posted 11 years ago on Wednesday January 2, 2013 | Permalink
  3. Sorry, yeah, I should have said warning :) Thanks for passing it on!

    Posted 11 years ago on Wednesday January 2, 2013 | Permalink
  4. We were not able to recreate this issue. Can you please export your form as XML and also the code you are using to populate the list? Please email the two attach the two files and email them to chris@rocketgenius.com - thank you.

    Posted 11 years ago on Thursday January 3, 2013 | Permalink