Skip to Content Skip to Menu

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

Assign values to radio button fields and add them up (when turned on).

  • krileon
  • krileon
  • ONLINE
  • Posts: 48454
  • Thanks: 8280
  • Karma: 1443
8 years 1 month ago #286298 by krileon

1. Just wasn't sure I needed special line break characters with multiple lines.

Nope, just use normal PHP.

2. What is the formula for adding the results of two code field values.

Just substitute in the code field. Should work fine. You may need to use the below usage.

[cb:userdata field="FIELD_NAME" /]


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.

  • tiekubd
  • tiekubd
  • OFFLINE
  • Posts: 68
  • Thanks: 1
  • Karma: 0
8 years 1 month ago #286301 by tiekubd
So this should be valid:

return (int) '[cb:userdata field="FIELD_NAME1" /]' + (int) '[cb:userdata field="FIELD_NAME2" /]';

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48454
  • Thanks: 8280
  • Karma: 1443
8 years 1 month ago #286303 by krileon
Yes, just be sure to change the field names to the actual names of your fields.


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.

  • tiekubd
  • tiekubd
  • OFFLINE
  • Posts: 68
  • Thanks: 1
  • Karma: 0
8 years 1 month ago #286308 by tiekubd
Works perfectly.

I have set up many Radio Button fields. However one of the radio buttons won't stay selected in user profile. What could the reason be?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48454
  • Thanks: 8280
  • Karma: 1443
8 years 1 month ago #286331 by krileon
What value does that radio button have? Could be related to its value if it's 0 causing it to think no value is selected.


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.

  • tiekubd
  • tiekubd
  • OFFLINE
  • Posts: 68
  • Thanks: 1
  • Karma: 0
8 years 1 month ago #286336 by tiekubd
All the radio buttons I've created have 2 values: 0 and another integer value. All the others allow me to select one or the other. This particular field does not keep my selection when I click save.

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

Moderators: beatnantkrileon
Powered by Kunena Forum