[SOLVED] How to add image to checkbox

8 years 11 months ago #142919 by memochipan
Hi, this is my first post.

I need a checkbox field with images. How can i do this?

The idea is that my users can pick an image that they like.:P

Thanks for help.

Post edited by: krileon, at: 2010/10/08 21:38
8 years 11 months ago #142929 by memochipan
I used the image tag in the options, and the images are displayed, but no value is saved in the MySQL table.

Any suggestion.

Thanks.
Attachments:
8 years 11 months ago #142992 by memochipan
Nobody can help?
8 years 11 months ago #143003 by krileon
Images are not supported for select fieldtypes. The values will be cleaned before store/display. You should create a new fieldtype plugin to handle this or use a drop-down select in combination of substitutions in a delimiter to display the images. I also recommend upgrading to CB 1.2.3, you posted in CB 1.2.2 boards.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM EST to 4:00 PM EST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
8 years 11 months ago #143401 by memochipan
Thanks krileon.

I tried to create a new fieldtype plugin but I don't understand all that I need to do that, and I didn't find documentation about the process other than analyze existing plugins.

I think that create a fieldtype plugin is a very good idea, because it can be reuse in other cases.

Could you help me a little bit in that process?

Could you explain me what are you talking about when you said:

or use a drop-down select in combination of substitutions in a delimiter to display the images.


Again, thanks a lot.
8 years 11 months ago #143408 by krileon
You could have a drop-down field with the following values. Lets call this field color so is stored as cb_color.

red
blue
green

Then using substitutions you could do the following in a delimiter field.

[code:1]
[cb:if cb_color!=""]<img src="/images/[cb_color].png" alt="[cb_color]" />[/cb:if]
[/code:1]

Then within the images folder you'd have the following images.

red.png
blue.png
green.png

This is just a minor example of what's possible. Please review tutorials within my signature for substitution usage information.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM EST to 4:00 PM EST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Moderators: beatnantkrileon
Time to create page: 0.443 seconds
Facebook Twitter Google LinkedIn