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.

How do I create a custom field with dropdown choices?

  1. Hi,

    I'm creating a custom form field by hooking into gform_add_field_buttons on the backend.

    I am also trying to give it the same settings as dropdown in the sense that I would like to have the ability to add choices. I have added .choices_setting to the fieldSettings array for the particular field which gives me the choices label and the button to pre populate the choices (and also the enable choices checkbox)

    What it doesn't give me though is the initial three starting choices that the dropdown field gives me - all I get is and empty box here.

    The HTML being generated for this bit is
    <ul id="field_choices"></ul> so GF is clearly not generating the choices by virtue of including the .choices_setting in the array.

    So, the question is - does anyone know how to get those initial default choices showing on a custom field?

    Cheers guys,
    Chris

    Posted 7 years ago on Sunday December 30, 2012 | Permalink
  2. Can you post a link to the page on your site where we can see the form, and paste your code at pastie.org or pastebin.com so we can see how you're using the functions? Please post all the relevant code. Thank you.

    Posted 7 years ago on Sunday December 30, 2012 | Permalink