Skip to Content Skip to Menu

Green/Red vs. Blue Buttons

  • bascherz
  • bascherz
  • OFFLINE
  • Posts: 228
  • Thanks: 29
  • Karma: 11
3 years 11 months ago #322098 by bascherz
Green/Red vs. Blue Buttons was created by bascherz
My client wants the green Yes and red No buttons shown when I setup a field as a single-select checkbox to both be blue like the ones setup as radio buttons. So I don't break a bunch of Auto Actions and other CB elements depending on those radio button field values stored as "Yes" and "No", is it fairly easy to change the single-select checkbox Bootstrap buttons to use the same attribute as the blue ones? Where would I put that CSS and what would it look like?

Thanks in advance,
Bruce

Bruce S - Vienna, VA

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

  • bascherz
  • bascherz
  • OFFLINE
  • Posts: 228
  • Thanks: 29
  • Karma: 11
3 years 10 months ago #322114 by bascherz
Replied by bascherz on topic Green/Red vs. Blue Buttons
Just as a note, I did look at using a CB template for this, but that makes it seem like I would have to do a total replacement site-wide of the Bootstrap button classes. Don't want to do that.

Bruce S - Vienna, VA

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48548
  • Thanks: 8290
  • Karma: 1445
3 years 10 months ago - 3 years 10 months ago #322131 by krileon
Replied by krileon on topic Green/Red vs. Blue Buttons
You'd have to complete override the btn-danger and btn-success classes for that field. Example as follows.

Code:
#cbfr_FIELD_ID_HERE .btn-group-list input:checked + .btn-success { /* GREEN BUTTON CSS HERE */ } #cbfr_FIELD_ID_HERE .btn-group-list input:checked + .btn-danger { /* RED BUTTON CSS HERE */ }

Replace FIELD_ID_HERE with the actual ID of your field. For example you'd have the below if you want them to be styled same as primary button when selected.

Code:
#cbfr_123 .btn-group-list input:checked + .btn-success, #cbfr_123 .btn-group-list input:checked + .btn-danger { color: #fff; background-color: #007bff; border-color: #007bff; }

If you want it to apply to all yesno checkbox fields instead of specific fields replace #cbfr_FIELD_ID_HERE with .cbft_checkbox.cbtt_group. Example as follows.

Code:
.cbft_checkbox.cbtt_group .btn-group-list input:checked + .btn-success, .cbft_checkbox.cbtt_group .btn-group-list input:checked + .btn-danger { color: #fff; background-color: #007bff; border-color: #007bff; }


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.
Last edit: 3 years 10 months ago by krileon.

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

  • bascherz
  • bascherz
  • OFFLINE
  • Posts: 228
  • Thanks: 29
  • Karma: 11
3 years 10 months ago #322135 by bascherz
Replied by bascherz on topic Green/Red vs. Blue Buttons
Where does this code go? And does this class have to be entered into the field's CSS Classes box?

Thanks!

Bruce S - Vienna, VA

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48548
  • Thanks: 8290
  • Karma: 1445
3 years 10 months ago #322137 by krileon
Replied by krileon on topic Green/Red vs. Blue Buttons

Where does this code go?

Use the built in CSS override functionality shown below.

www.joomlapolis.com/blog/kyle/18711-template-css-overrides-made-easy

And does this class have to be entered into the field's CSS Classes box?

The provided examples do not depend on the CSS Class parameter, but you could use the parameter if you like. Example as follows.

CSS Class: blueYesNo

Code:
.blueYesNo .btn-group-list input:checked + .btn-success, .blueYesNo .btn-group-list input:checked + .btn-danger { color: #fff; background-color: #007bff; border-color: #007bff; }


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