• 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: calculation script

calculation script 13 years 2 weeks ago #13420

  • gurvin
  • gurvin's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
I have designed a form using rsforms pro
form URL
www.booklink2.jewelcart.net/payment-solu...ment-processing.html

In the estimated processing section

I want the total of these 3 fields

1) Card swiped through a Card Terminal in %
2) Cards Keyed in and also Imprinted Manually in %
3) Cards Keyed in with no imprints (Phone/Internet) in %

to be 100 in the 4 field

4) (Total must equal 100%)

Kindly provide solution
The administrator has disabled public write access.

Re:calculation script 13 years 2 weeks ago #13436

  • andreic
  • andreic's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 722
  • Thank you received: 59
Hello,

Please try using adding the following script in the "CSS and Javascript" tab of your form:
<script type="text/javascript">
function perC(){
	fields = new Array("field1","field2","field3");
	total =0;
	for (i=0;i<fields.length;i++) 
		if (document.getElementById(fields[i]).value != '') total = parseInt(total) + parseInt(document.getElementById(fields[i]).value);
	document.getElementById('total_field').value = total;
	if (total != 100) alert('The value of the total field must be 100!');
}
</script>

In order to trigger this script when the user switched the focus from the last field that is added to the total you will need to add the following line in the "Additional attributes" property of the field:
onblur="proC();"
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.
  • 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!