Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] radiobutton problem

8 years 10 months ago - 8 years 10 months ago #275597 by Henke_Carlsson
[SOLVED] radiobutton problem was created by Henke_Carlsson
I have used HTML in profile edit value layout because I wanted to change the layout on a radio button field.

A example

<!
<span class="cbSnglCtrlLbl"><label for="cbf428" class="radio-inline"><input type="radio" name="cb_field" value="1" id="cbf428" checked="checked" aria-invalid="false"> 1 </label></span>

<span class="cbSnglCtrlLbl"><label for="cbf429" class="radio-inline"><input type="radio" name="cb_field" value="2" id="cbf429"> 2 </label></span>
>

The selected value saves in database and shows up on the users profilpage. The problem is that when the user comes back to the profile edit page the radio buttons is unchecked. And the user must enter all the information again. Is it possible to have the selected value always checked?
Last edit: 8 years 10 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48464
  • Thanks: 8280
  • Karma: 1443
8 years 10 months ago - 8 years 10 months ago #275625 by krileon
Replied by krileon on topic radiobutton problem
You need to handle that directly in your HTML. One way to do this is using a substitution IF statement. Example as follows.


[cb:if cb_field="1"]checked="checked"[/cb:if]

That can be used to add the checked attribute to the radio input for example (or any attribute, CSS class even, etc..).

Why specifically are you doing this though? What are you trying to change for the radio field edit display?


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: 8 years 10 months ago by krileon.
The following user(s) said Thank You: Henke_Carlsson

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

8 years 10 months ago - 8 years 10 months ago #275646 by Henke_Carlsson
Replied by Henke_Carlsson on topic radiobutton problem
Thank you for answer! I will try that!

First of all I changed so the first and the last radiobutton had a image over them.(But right now, I dont know if it is smarter to have a image/text field which contains the images over the radio button field instead?)

And the second reason is that I want do replace all radiobuttons in the field with different images. So instead of the grey default appereance they have a more red color. (Maybe I can fix this directly in the override.css file i created instead?) I will test my way forward a good solution :)
Last edit: 8 years 10 months ago by Henke_Carlsson.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48464
  • Thanks: 8280
  • Karma: 1443
8 years 10 months ago #275655 by krileon
Replied by krileon on topic radiobutton problem
You don't need to alter the output to have an image. You can do that directly with CSS or you can use a language string for the radio value label. Example as follows.

Value: 1
Label: MY_FIELD_VALUE_1

'MY_FIELD_VALUE_1' => 'IMG_HERE'


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.
The following user(s) said Thank You: Henke_Carlsson

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

8 years 10 months ago #275670 by Henke_Carlsson
Replied by Henke_Carlsson on topic radiobutton problem
Thanks for the advice! I will do it with just CSS & language strings instead!

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

Moderators: beatnantkrileon
Powered by Kunena Forum