• 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: how do I include decimal points in calculations

how do I include decimal points in calculations 16 years 4 months ago #5814

  • nyree
  • nyree's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 13
Hi

how do I use decimal points eg 17.5 x 10?

I am using this element to calculate 2 dropdown values:

onclick=\"document.getElementById('total').value = parseInt(document.getElementById('Field1').value) * parseInt(document.getElementById('Field2').value);\"


at the moment it ignores the decimal point and returns 170 instead of 175

any suggestions?

thanks
The administrator has disabled public write access.

Re:how do I include decimal points in calculations 16 years 4 months ago #5845

  • octavian
  • octavian's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 783
  • Thank you received: 110
Hello,

Instead of parseInt you should use parseFloat. parseInt() is a javascript function that forces an integer out of any value. You need a floating point value.
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:how do I include decimal points in calculations 16 years 4 months ago #5880

  • nyree
  • nyree's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 13
Works now!!

Sooooo easy when you know how!!

thanks again
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!