• 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: Radio Group Calculations

Radio Group Calculations 15 years 4 months ago #6220

I tried my best to follow the example already given for this, but I can't get it to work. I have 10 radio groups with two values each.

Radio Groups are named: Radio1 -> Radio10
Values: 0|No, 1|Yes
Hidden Field: result

I'm trying to get the calculate() that I took from the scripts/customization page to calculate each radio's value if checked and total that value. The value is returned to the hidden field result which is setup just as the example said. I have {result:value} on the thank you page for testing purposed, but it always shows 0. Any help appreciated!
The administrator has disabled public write access.

Re:Radio Group Calculations 15 years 1 week ago #7372

  • tharald
  • tharald's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
I´m having the same problem, does anyone have the example from this page working?

www.rsjoomla.com/customer-support/docume...up-calculations.html
The administrator has disabled public write access.

Re:Radio Group Calculations 15 years 4 days ago #7410

  • alexp
  • alexp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 2253
  • Thank you received: 180
Hello,

The correct script is:
<script type="text/javascript">
function calculate()
{
	var op1=document.getElementsByName('form[radio1]');
	var op2=document.getElementsByName('form[radio2]');
	var result=document.getElementById('result');
	result.value=0;
	result.value=parseInt(result.value);
	for(i=0;i<op1.length;i++)
		if(op1[i].checked) result.value=parseInt(result.value)+parseInt(op1[i].value);
	for(i=0;i<op2.length;i++)
		if(op2[i].checked) result.value=parseInt(result.value)+parseInt(op2[i].value);
	alert(result.value);
	return false;
}
</script> 
 
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

Re:Radio Group Calculations 15 years 4 days ago #7416

  • tharald
  • tharald's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
Thanks for your help. Greatly appreciated.

One thought; It would be great to get the calculation on the form page itself. That would probably take some work but would be a great addition.
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!