Can a set of images that have been uploaded in a post populate a multiple choice and checkbox field?
I am creating a form that will allow the user to pick one image (multiple choice) and then later select more than one (checkbox).
Can a set of images that have been uploaded in a post populate a multiple choice and checkbox field?
I am creating a form that will allow the user to pick one image (multiple choice) and then later select more than one (checkbox).
I'll have one of our developers take a look and give you some guidance. It's towards the end of the day on Friday so there may be a delay in receiving a response with the weekend, etc. so be patient and i'll make sure someone responds.
This snippet will populate all of the post images that have been uploaded for the current post the Gravity form is being displayed on. You can indicate which field should display the post images by defining the class as "post-images" in the GF form admin. This code will work with multiple choice fields but may require some additional work for checkboxes. Use it as a base and go from there. :)
David, thanks for your help!
It pulled in the images just fine and seems to work well with checkboxes. Only problem I see is when you have more than one multiple choice or checkbox fields; it appears that every time there is another field it adds an extra loop. So, if the first field shows three images, the next displays six and the next displays nine and so on.
Also, is it possible to return the image name vs the ID?
Thanks!
Try this: http://pastie.org/2678465
Worked beautifully! This is going to be very nice. I really appreciate it! (Got a donate link?)
Mixing text and the dynamically populated images in a multiple choice is probably out of the question, huh? (Example: Select the pose you would like to appear in the yearbook: Pic1, Pic2, Pic3, Retake, please) Of course, I could include a "Retake" image.
Since the label is completely separate from the actual value of the field, you can do pretty much whatever you want in the label. In the code above, the label consists of this string on line 20:
[php]
"<img src=\"{$image_deets[0]}\" />"
You could add the image title there as well like so:
[php]
"<img src=\"{$image_deets[0]}\" /><br />{$image->post_title}"
Now, to change the size or alignment of the images, I would have thought I could edit the post-images class. I seem to be wrong...
Bookmarked!