• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: [SOLVED] calculation not working...

[SOLVED] calculation not working... 7 years 10 months ago #35398

  • pirra
  • pirra's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
hi everyone,
I need to create a form with some "Radio Groups".
Each option has a numeric value.
So the form should calculate a sum at the end of every choice.
I have done this

radio group A
1|YES
0|NO

radio group B
1|YES
0|NO

radio group C
1|YES
0|NO

textbox TOTAL

then in the Form Properties --> Calculations
I set
TOTAL = {radio group A:value}+ {radio group B:value}+ {radio group C:value}

is this correct? or not?
because I don't get any total in textbox... it remains at 0 :-(

Even if I send the form, when I check the submissions data, I can see the corrects values
for the radio groups (1 or 0) but the textbox is 0

thanks in advance
Last Edit: 7 years 10 months ago by pirra.
The administrator has disabled public write access.

calculation not working... where am I wrong? 7 years 10 months ago #35399

  • pirra
  • pirra's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
solved!
I enter the following syntax for each radio group
ant it works.

YES|YES[p1]
NO|NO[p0]

I don't understand if [p] is for price ... because my calcultion is not related to money...
anyway the forms does what I need
The administrator has disabled public write access.

calculation not working... where am I wrong? 10 months 5 days ago #42847

  • DiGwork
  • DiGwork's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 32
I am having exactly the same issue can anyone comment please?
The administrator has disabled public write access.

calculation not working... where am I wrong? 10 months 4 days ago #42848

  • iceferret
  • iceferret's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 216
  • Thank you received: 57
You could try using javascript like this
function updateTotal() {
      var groupAValue = parseInt(document.querySelector('input[name="groupA"]:checked').value);
      var groupBValue = parseInt(document.querySelector('input[name="groupB"]:checked').value);
      var groupCValue = parseInt(document.querySelector('input[name="groupC"]:checked').value);
 
      var total = groupAValue + groupBValue + groupCValue;
      document.getElementById('total').value = total;

this listens for the onclick event on each radio input. Whenever a radio button is clicked, the updateTotal() function is called, which retrieves the selected values from each radio group and calculates the total. The total is then updated in the total input field. I've not checked it but it should give you a start
If you can keep your head when all about you are losing theirs, then you obviously don't understand the situation!
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!