• 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: Trim result after calculation

Trim result after calculation 12 years 6 months ago #15096

Hello,

I have made a calculation in RSformPro. I used the field {total} for the result. This give a result like 15.453943. How can I trim this to two digits, e.g. 15.45?

regards,
Joost Bloom
The administrator has disabled public write access.

Re: Trim result after calculation 12 years 6 months ago #15098

  • webcat-solutions
  • webcat-solutions's Avatar
  • OFFLINE
  • Junior Boarder
  • Dutch Joomla specialist
  • Posts: 29
  • Thank you received: 4
You could use the php round function for this (http://php.net/manual/en/function.round.php.
The administrator has disabled public write access.

Re: Trim result after calculation 12 years 6 months ago #15141

Maybe you can help me... Below is the code I use. How do I have to change it to get the two digits...
Many thanks.

onclick="document.getElementById('total').value = ((parseInt(document.getElementById('Kantoorruimten').value)/600 + parseInt(document.getElementById('Sanitaireruimten').value)/90) + (parseInt(document.getElementById('Vergaderruimten').value)/800) + (parseInt(document.getElementById('Gangenhallentrappenhuizen').value)/1200) + (parseInt(document.getElementById('Pantrykantinerestaurant').value)/600))*((parseInt(document.getElementById('Schoonmaakfrequentie').value)*52)/12)*21.5;"
The administrator has disabled public write access.

Re: Trim result after calculation 12 years 6 months ago #15166

  • alexp
  • alexp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 2253
  • Thank you received: 180
You could try using something like this:
onclick="document.getElementById('total').value = (((parseInt(document.getElementById('Kantoorruimten').value)/600 + parseInt(document.getElementById('Sanitaireruimten').value)/90) + (parseInt(document.getElementById('Vergaderruimten').value)/800) + (parseInt(document.getElementById('Gangenhallentrappenhuizen').value)/1200) + (parseInt(document.getElementById('Pantrykantinerestaurant').value)/600))*((parseInt(document.getElementById('Schoonmaakfrequentie').value)*52)/12)*21.5).toFixed(2);"
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!