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.

Dynamically Populate Checkboxes based on Post Names

  1. Hi Guys,

    First off, wonderful plugin - i use it regularly and exclusively for all my sites.

    So i'm developing a site for a client who is using Events Calendar to create events for their various webinars - What they want is a webinar sign-up form with a listing of current webinars to select from via checkbox field. Is there an elegant way to set a checkbox field to auto populate w/ the current listing of posts from a given category? It seems doable, though i'm at a loss as to the best way to approach it, i want to think that Gravity Forms' Dynamic content functionality could be used here?

    Thanks!

    -Tm

    Posted 13 years ago on Thursday June 30, 2011 | Permalink
  2. This snippet will populate any multiple option field (radio, checkbox, drop down) with a CSS class of "populate-posts" (http://tardis1.tinygrab.com/at7I) with a list of posts: http://pastie.org/2148642

    Checkbox fields are a little different in how the selected checkboxes are captured. If you had a checkbox field in the admin with only 3 fields. Only the first 3 posts populated into this field would be captured. Rather than updating the field constantly with new blank options to capture the dynamically popluated values, just create a large number of empty options so that you will be sure to always have a "blank" option for the dynamically populated post: http://tardis1.tinygrab.com/at7J

    Posted 13 years ago on Friday July 1, 2011 | Permalink
  3. im having problems with my code here:

    http://pastie.org/2151399

    im trying to put the content values of the custom post type on checkbox "value" attribute, but the values being pass is the content of the current page, please help..

    Posted 13 years ago on Friday July 1, 2011 | Permalink
  4. Hi webpuzzlemaster,

    Try updating this line:

    [php]
    $content = get_the_content();

    to this:

    [php]
    $content = $post->post_content;
    Posted 13 years ago on Saturday July 2, 2011 | Permalink
  5. thanks.. will try it now...

    edited:
    It works! thanks.. another question..
    is it possible to pass HMTL codes as values for the "VALUE" attribute of checkbox? im planning to use that value and place it as a tooltip

    Posted 13 years ago on Saturday July 2, 2011 | Permalink
  6. Ya know, I've never tried. I'm assuming so long as you escape the double quotes and the HTML < > correctly, it should work. Give it a try and let us know how it goes. :)

    Posted 13 years ago on Saturday July 2, 2011 | Permalink
  7. that's what i did..
    esc_attr()

    thanks!

    im looking around the forum about my other problem, adding a qtip on labels from the checkbox "value" attribute.. haha..

    Posted 13 years ago on Saturday July 2, 2011 | Permalink
  8. beside text and value, are there any options in this line of code
    $choices[] = array('text' => $post->post_title, 'value' => $post->post_title);

    Posted 13 years ago on Monday July 4, 2011 | Permalink
  9. The array only consists of the text and the value. It doesn't consist of any additional data.

    Posted 13 years ago on Tuesday July 5, 2011 | Permalink
  10. is there a possibility to get the values of the "text" attribute when submitting the form instead of the "value" attribute, even if the "value" attribute has value

    Posted 13 years ago on Wednesday July 6, 2011 | Permalink
  11. any one? please reply..

    Posted 13 years ago on Wednesday July 20, 2011 | Permalink
  12. Hi Puzzlemaster,

    Could you give me an example of the reasoning behind this? It might help me think of a solution that will work for you.

    Posted 13 years ago on Wednesday July 20, 2011 | Permalink
  13. i already fix it, i created the label for the checkbox as a link and add the contents to the title attribute and created a tooltip out of that..

    Posted 13 years ago on Thursday July 21, 2011 | Permalink

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