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.

Cascading dynamic fields

  1. sciamannikoo
    Member

    Hello.

    I've spend about an hour looking for a solution to my need, but I didn't find the right way to do it.

    This is what I'd like to do:

    • There is a 4 pages form.
    • In the first page, I've a dropdownlist the we'll call "studytrips".
    • This list is populated using add_filter('gform_pre_render_1', 'populate_studytrip'); and retrieving all posts of a specific type (custom post types) and with other filtering logic.
    • Once an item is selected, a radio button list is shown.

    Until here I haven't any issue.

    Each of the "studytrips" post (step #2 above) contains a specific meta data (custom field), called "periods". This custom field can recur one or more times.
    So I could have, for the post X, this meta data:
    periods = August 12, 2011 - August 20, 2011
    periods = August 20, 2011 - August 27, 2011
    periods = August 27, 2011 - September 3, 2011
    ...

    The radio button list, given the post_id (from the dropdownlist value "studytrips"), must retrieve this data.

    This is the step I'm stuck on right now.
    Actually, I've already created a call to add_filter('gform_pre_render_1', 'populate_period');, but I don't know how to get the value from the dropdownlist, since the form isn't doing any post.
    Maybe I could get the value, putting the radio buttons in a second page, but this would go against the usability and more important, the logic of this form (each step is a specific category of fields that needs to be filled).

    Thanks.

    Posted 12 years ago on Friday July 15, 2011 | Permalink
  2. sciamannikoo
    Member

    For what is worth, this is the URL of the form page: http://progettoanike.org/pre-iscrizione-alla-vacanza-studio-a-bobo-dioulasso-burkina-faso/

    Posted 12 years ago on Friday July 15, 2011 | Permalink
  3. sciamannikoo
    Member

    Two hours for the week-end closing, eleven hours from my request post and still no answer.
    I was expecting a quicker answer from the support of a premium plugin.
    Instead I'll probably have to wait the whole week-end (if not even more) and get stuck to this issue.

    Posted 12 years ago on Friday July 15, 2011 | Permalink
  4. We'll take an in-depth look at your request as soon as we can. Priority support requests from Developer license holders get taken care of first ( in the order they're received ) then we move through the forums as quickly as we can to offer assistance. 11 hours ago was also 4 hours before our posted support hours ( I know we're in different time zones ) so please try to be patient as we get back to you.

    Posted 12 years ago on Friday July 15, 2011 | Permalink
  5. sciamannikoo
    Member

    Ok. My mistake.

    I've a developer license: I've posted in the wrong place.

    I'm gonna report in the right place now.

    Posted 12 years ago on Friday July 15, 2011 | Permalink
  6. Your question is regarding a customization. Customer issues involving core functionality and issues such as the plugin is broken or not working take priority of questions regarding customizations. Customizations aren't considered support, they are customizations.

    We do help users with customization issues or questions as we have time, but true support issues take priority when answering questions on the forum.

    I'll have our lead developer take a look at what you are trying to do and he'll post with his thoughts.

    Posted 12 years ago on Friday July 15, 2011 | Permalink
  7. sciamannikoo
    Member

    Ok. Now I know is a customization: for the knowledge I have about this plugin (this is my first attempt of using it, as I've bought it for this specific purpose) it could have been either an existing feature that wasn't working, I didn't know how to use it or, as you're writing, a customization.

    Just to recap: the only things I need to know is how to populate a radio button group with values based on another field (dropdownlist).

    Posted 12 years ago on Friday July 15, 2011 | Permalink
  8. This is a tricky customization. I think the easiest way to pull this off is using jQuery. I am going to point you in the right direction with some generic ideas to get you started. If you have trouble with some of them, I can be more specific. This is what you will need to do:

    1- In the gform_pre_render_1 filter, in addition to populating the drop down, you will need to inject javascript to the page containing an array of all studytrips and for each studytrips, an array for all periods. In PHP, the structure I am thinking about would look like the following:

    array("1" => array("August 12, 2011 - August 20, 2011", "August 20, 2011 - August 27, 2011"),
             "2" => array("September 12, 2011 - September 20, 2011", "September 20, 2011 - September 27, 2011"))

    Where 1 and 2 are the studytrip IDs. You will need to create something similar in Javascript.

    2- In the same gform_pre_render_1 filter, will will also inject Javascript code to bind to the drop down's onchange event, read the javascript array to get the periods for the currently selected studytrip and rebuild the radio button list using jQuery based on the periods.

    Your code will look somewhat like the following
    http://pastie.org/2219838

    Posted 12 years ago on Friday July 15, 2011 | Permalink
  9. sciamannikoo
    Member

    Thank you Alex: I have to try it, but as far as I can see your idea makes sense.
    I'll post an update after having tried it.

    Thank you again.

    Posted 12 years ago on Friday July 15, 2011 | Permalink
  10. sciamannikoo
    Member

    I can confirm: Alex's tip helped me. I can now populate my radio buttons group.

    Now it's time to fight with Gravity Forms multilingual plugin, that doesn't works as expected, but this is another story and more important, a WPML issue.

    Thanks again.

    Posted 12 years ago on Saturday July 16, 2011 | Permalink

This topic has been resolved and has been closed to new replies.