How can I add sublabels to the Image Checkboxes widget?

  • veggies4good
    Asked on June 16, 2020 at 11:24 PM

    1592363953Screenshot 2020 06 17 The Easi Screenshot 10

    The reason I'm asking is I want the font of the Sublabel to be different from the font of the image Title.  In the screenshot above, I just typed "Title Sublabel" in the image Title.

    If it's not possible to add sublabels, is there a way to change the font of different words in the image title?

  • Patrick_R
    Replied on June 17, 2020 at 2:42 AM

    Hi! Image title are the only text that you can have for your checkboxes. You can use CSS code to modify the font size, color, family etc.

    - If it's not possible to add sublabels, is there a way to change the font of different words in the image title?

    Looks like, it is possible using CSS content and nth-child properties. Please have a look at this demo form that I prepared for this purpose: https://form.jotform.com/201680792537057

    1592376159chrome capture (73) Screenshot 10

    The code implemented in the above example is: https://pastebin.com/73aS2qcg

    You can implement this code (with your modifications) in your form for your Checkboxes widget using these instructions: https://www.jotform.com/help/428-How-to-Inject-CSS-Codes-to-Widgets

    I hope this helps. For further queries, feel free to write back to us.

  • veggies4good
    Replied on June 17, 2020 at 4:31 AM

    Hi Patrick,

    Thanks for your quick and great response. I thought this is not possible, but you found a way to do it! Now I know CSS content property and the selectors after and nth-child.

    1592382912sublabel2 Screenshot 10

    Just a follow-up question. Is it possible to inject the CSS code in the form itself instead of injecting it inside the widget? If yes, please show me the syntax (given the widget id).

    I have multiple Image Checkboxes widgets in a form. I wish to put the CSS codes in one place so that it will be easier for me to edit the sublabels when needed. Thanks :)

  • veggies4good
    Replied on June 17, 2020 at 4:33 AM
  • Patrick_R
    Replied on June 17, 2020 at 5:47 AM

    Hello! I am glad to know that helped.

    - Just a follow-up question. Is it possible to inject the CSS code in the form itself instead of injecting it inside the widget? If yes, please show me the syntax (given the widget id).

    Unfortunately, no. You'll have to inject this CSS code separately for every widget. This is because every Image Checkbox widget runs in its own iFrame. iFrames do not share scripts and styles from the parent page.

    The CSS you implement for these widgets are applied individually to the iFrame you apply it to.

    I hope this helps. For further queries, feel free to get back to us.

  • veggies4good
    Replied on June 17, 2020 at 10:36 AM

    Thank you for your answer. I understand.

  • Ivaylo JotForm Support
    Replied on June 17, 2020 at 11:10 AM

    You are most welcome.

    If you have any other questions or concerns in future, please do not hesitate to reach out again.

  • veggies4good
    Replied on June 18, 2020 at 6:46 AM

    I need help again with this sublabel solution. Before injecting the sublabels CSS code from Patrick, the image titles are limited within the image width (or with word-wrap property).

    1592476859Screenshot 2020 06 18 The Easi Screenshot 10

    After injecting the sublabels CSS code, the spacing between the images are no longer the same because of long titles or long sublabels.

    1592476997Screenshot 2020 06 18 The Easi Screenshot 21

    How do I keep the word-wrap property and maintain the consistent spacing between the images?

  • Ivaylo JotForm Support
    Replied on June 18, 2020 at 8:14 AM

    In order to avoid confusion, I moved your last question to a separate ticket here:

    https://www.jotform.com/answers/2397010-After-injecting-the-sublabels-CSS-code-the-spacing-between-the-images-are-no-longer-the-same

    I will reply to that ticket shortly.