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.

Dynamical population of dropdown

  1. Hello

    I have seen the documentation you provide
    http://www.gravityhelp.com/documentation/page/Dynamically_Populating_Drop_Down_Fields
    and also
    http://www.gravityhelp.com/documentation/page/Gform_pre_render

    but when implementing in my site I get a blank page when I try the view the resulting form. Also when implementing the code of the second link above and try to update the post I also get a blank one with this url http://mysite.com/wp-admin/post.php

    Before going deeper, are your samples still valide? just in case they are not anymore with las wp versions.

    Thanks

    Posted 11 years ago on Thursday February 7, 2013 | Permalink
  2. If you get a blank page, it is likely you are experiencing a 500 Internal Server error. Please check your server's PHP or Apache error logs to see what the error is.

    If you're using PHP 5.3, it's possible this notation will not work for you, and will throw an error:

    [php]
    // this code can throw an error
    foreach($form["fields"] as &$field) {
    
    // you might need to change it to this
    // drop the ampersand
    foreach($form["fields"] as $field) {
    Posted 11 years ago on Friday February 8, 2013 | Permalink
  3. Ok, with that now the page is displayed but the dropdown is not populated.
    I just copied this code
    http://www.gravityhelp.com/documentation/page/Dynamically_Populating_Drop_Down_Fields

    and checked this advanced option:
    Allow field to be populated dynamically(?)

    Should I do something special with "choices" in the form? Do I leave the default First, second and third choice?

    I correctly write the css class to be checked.

    Thanks

    Posted 11 years ago on Friday February 8, 2013 | Permalink
  4. You have not given us enough information to help you yet.

    What are you trying to populate the dropdown with? What code are you using exactly to populate the dropdown? Please post the code at pastebin.com or pastie.org.

    Please share a URL to the page on your site where the form is embedded if it will help us.

    Thank you.

    Posted 11 years ago on Saturday February 9, 2013 | Permalink
  5. Hello

    here you have my code
    http://pastebin.com/5ugJcxFT

    I am testing it locally so there is no page to check it. If with taht code is not enough to figure out a solution I will try to do it live.

    Thanks

    Posted 11 years ago on Saturday February 16, 2013 | Permalink
  6. On line 12 of your paste, can you place a debug statement to dump the $posts array (use var_dump or print_r). We need to see what $posts contains at that point before trying to populate your drop down.

    Posted 11 years ago on Monday February 18, 2013 | Permalink