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.

Each radiobox selection displays image?

  1. moltogelato
    Member

    Is is possible to have each radiobox selection for a product display a different image? So that depending on which option is selected the user will see an image of the product/variation they have selected?

    Posted 11 years ago on Saturday January 5, 2013 | Permalink
  2. If you don't have a lot of products, you can use an HTML block with the image in it, and display that block with conditional logic depending on which radio button choice is selected. Here is an example: http://gravity.chrishajer.com/different-image-for-each-radio-button-selection/

    Does that work for you?

    Posted 11 years ago on Monday January 7, 2013 | Permalink
  3. moltogelato
    Member

    That's exactly what I want. Thanks!

    Was that one html block with the four pictures or four different html blocks?

    How did you get the picture to display to the right side of the radio buttons instead of below?

    Posted 11 years ago on Tuesday January 8, 2013 | Permalink
  4. It was five individual HTML blocks. You need to do it like that so you can use one radio condition to show one image. One block for each image.

    To get the radio buttons on the left and HTML block (image) on the right, you can add the Custom CSS Class on the Advanced tab of each field. I used gf_left_half for the radio button field and gf_right_half for each of the five HTML fields.

    Posted 11 years ago on Tuesday January 8, 2013 | Permalink
  5. moltogelato
    Member

    Thanks! I have the image url. What code do I put in the html box?

    Posted 11 years ago on Tuesday January 8, 2013 | Permalink
  6. If you have the URL, the image tag will look like this in the HTML box:

    [html]
    <img src="http://example.com/image.jpg" />

    That is the basic format. You can add a title and alt attribute if you want, and it's required for validation, but this tag will make the image show up on your page.

    Posted 11 years ago on Tuesday January 8, 2013 | Permalink
  7. moltogelato
    Member

    Thanks - you guys are great.

    Posted 11 years ago on Wednesday January 9, 2013 | Permalink
  8. You're welcome. Glad you were able to make that work.

    Posted 11 years ago on Wednesday January 9, 2013 | Permalink

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