Skip to Content Skip to Menu

[SOLVED] radiobutton as image

  • Giankomat
  • Giankomat
  • OFFLINE
  • Posts: 56
  • Thanks: 0
  • Karma: -1
  • Add-ons
9 years 10 months ago - 9 years 10 months ago #254912 by Giankomat
[SOLVED] radiobutton as image was created by Giankomat
Hi, there is a way to 'render' a radiobutton field as image in profile page? I mean:
- in edit profile page a simple radiobutton with choices "opt1","opt2","opt3"
- but in profile page that opt1, opt2, opt3 should be replaced by images, like "<img src="opt1.jpg"/>", "<img src="opt2.jpg"/>","<img src="opt3.jpg" />"

I guess it's more simple to do than to explain :)
Last edit: 9 years 10 months ago by krileon.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48482
  • Thanks: 8283
  • Karma: 1443
9 years 10 months ago #254924 by krileon
Replied by krileon on topic radiobutton as image
Using the field layout feature in CB 2.x you can replace the fields output with substitution usage. Using a substitution IF statement you can output an image based off the value. Example as follows.

[cb:if FIELD_NAME="opt1"]<img src="opt1.jpg"/>[/cb:if]
[cb:if FIELD_NAME="opt2"]<img src="opt2.jpg"/>[/cb:if]
[cb:if FIELD_NAME="opt3"]<img src="opt3.jpg"/>[/cb:if]
[cb:if FIELD_NAME="opt4"]<img src="opt4.jpg"/>[/cb:if]

For more substitution usage information please see the below tutorial.

www.joomlapolis.com/support/tutorials/107-use-cases/18353-using-substitutions-throughout-cb

If you want the actual options in profile edit to display as images then you'll need to use CSS or possibly language strings that output HTML may work.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
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 CST to 4:00 PM CST. 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.

Please Log in or Create an account to join the conversation.

  • Giankomat
  • Giankomat
  • OFFLINE
  • Posts: 56
  • Thanks: 0
  • Karma: -1
  • Add-ons
9 years 10 months ago - 9 years 10 months ago #255061 by Giankomat
Replied by Giankomat on topic radiobutton as image
where should I add that code? Do you mean in custom html field?
I thought in CB2 there was a better method..
Last edit: 9 years 10 months ago by Giankomat.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48482
  • Thanks: 8283
  • Karma: 1443
9 years 10 months ago #255100 by krileon
Replied by krileon on topic radiobutton as image
Edit your radio field within CB > Field Management then under Parameters supply the substitution for "Profile Value Layout" which lets you override the profile display of the field.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
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 CST to 4:00 PM CST. 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.

Please Log in or Create an account to join the conversation.

  • Giankomat
  • Giankomat
  • OFFLINE
  • Posts: 56
  • Thanks: 0
  • Karma: -1
  • Add-ons
9 years 10 months ago #255147 by Giankomat
Replied by Giankomat on topic radiobutton as image
I tried, that code replaces my value with nothing (not a broken image, just nothing)..

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48482
  • Thanks: 8283
  • Karma: 1443
9 years 10 months ago #255179 by krileon
Replied by krileon on topic radiobutton as image
The code I've supplied is a template. It is not a working example. I've no idea what your field name is or the path to your images are. Please be sure you've replaced the necessary information. For example FIELD_NAME should become the name of your radio field (e.g. cb_myradio). The img src should correctly point to your images. The values being matched should match the actual values of your radio field.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
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 CST to 4:00 PM CST. 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.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum