How to include images in radio button field?

  • merkaz
    Asked on September 16, 2016 at 11:42 AM

    Hello, just rereshing this question.

    It seems to be that its not anymore possible to add src="YOUR_IMAGE_URL" to radio option?

     

    thank you

  • Kevin Support Team Lead
    Replied on September 16, 2016 at 12:00 PM

    I have tested this and it worked on my end, you need to add the image HTML tag as an option in the radio button: 

    How to include images in radio button field?  Image 1 Screenshot 20

    You can check the live result on my sample form: https://form.jotform.com/62595042677969 

    Also, we have a widget that will help you to achieve the same and indeed has been developed for that, please take a look to the widget here: https://widgets.jotform.com/widget/image_checkboxes 

    Hope this helps. 

  • merkaz
    Replied on September 16, 2016 at 12:07 PM

    yes, i teste the widget, but it seems not to be responsive as declared, thre is iframe inside which has the same fixed width as the form, and this width stays also by mobile devices.

    If not this problem - would be greate solution.

  • David JotForm Support
    Replied on September 16, 2016 at 2:30 PM

    This does indeed look to work at this time.  I added the following code to my radio button:

    <img alt="How to include images in radio button field? Image-0" src="https://www.jotform.com/uploads/david/form_files/download.jpg" style="width:50px;height:50px;">

    Replace the highlighted portion with your image URL.

    And the image was shown properly as the option:

    How to include images in radio button field?  Image 1 Screenshot 21

    Here is my test form with it working:

    https://form.jotform.com/62595285202962

     

  • merkaz
    Replied on September 21, 2016 at 9:46 AM

    yes, this is indeed mobile, i mean that the WIDGET solution is not mobile, probably because of iframe...

    Another question: how can i achieve that choosed option would get different css style? outlined or another background etc. ?

    Thanks

  • Kevin Support Team Lead
    Replied on September 21, 2016 at 12:52 PM

    Yes, the Image Radio Buttons widget does not load responsively by default, it has a fixed width, but you may inject some CSS code to set the width to 100% it means that the widget will fit the screen where it is being viewed. 

    I you're not using another widget you may simply inject this CSS code, it will affect to all the widgets in your form: 

    [data-type="control_widget"] iframe{

        width: 100% !;

    }

    But if you have other widgets you will need to specify the widget that the code will  affect, to get the widget iFrame ID you need to open the console, please follow the steps below: 

    How to include images in radio button field?  Image 1 Screenshot 20

    Then instead of using the code for general widgets you need to use the iFrame ID, so the code should look like this: 

    #customFieldFrame_3 {

        width: 100% !important;

    }

    I have applied the CSS code to the form and it loads responsively now, please take a look to the sample here: https://form.jotform.com/60525553364960 

    This guide will help you to inject the code to your form: How-to-Inject-Custom-CSS-Codes

    Hope this helps. 

  • merkaz
    Replied on September 27, 2016 at 4:25 AM

    Thank you very much for this helpfull answer.

    Another issue:

    download xls file with submissions.

    At the moment it is

    not collecting data from radio/image options - just empty fields
    .

    Any chance to still get data there?

     

    thank you

  • John_Benson
    Replied on September 27, 2016 at 7:28 AM

    I have moved your inquiry in another thread since it is already a different issue, so we can assist you better. Kindly wait for our reply to the given link for each issue.

    Download xls file with submissions: 

    https://www.jotform.com/answers/942767

     

    Not collecting data from radio/image options - just empty fields: 

    https://www.jotform.com/answers/942770

     

    Thank you.