• 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 to add Comma separtors in Sum textfields.

How to add Comma separtors in Sum textfields. 11 years 3 months ago #26309

Ok so I got the sum codes from demo.rsjoomla.com/calculation-form-example

and I got this code for my website.

<script type="text/javascript">
function calculateText(){

var op1=document.getElementById('family_home');
var op2=document.getElementById('home_contents');
var op3=document.getElementById('motor_vehicle');
var op4=document.getElementById('caravan');
var op5=document.getElementById('bank_account');
var op6=document.getElementById('superannuation');
var op7=document.getElementById('investment');
var op8=document.getElementById('other');

var result=document.getElementById('Total');

if(op1.value=="$0.00" || op1.value!=parseFloat(op1.value)) op1.value=0;
if(op2.value=="$0.00" || op2.value!=parseFloat(op2.value)) op2.value=0;
if(op3.value=="$0.00" || op3.value!=parseFloat(op3.value)) op3.value=0;
if(op4.value=="$0.00" || op4.value!=parseFloat(op4.value)) op4.value=0;
if(op5.value=="$0.00" || op5.value!=parseFloat(op5.value)) op5.value=0;
if(op6.value=="$0.00" || op6.value!=parseFloat(op6.value)) op6.value=0;
if(op7.value=="$0.00" || op7.value!=parseFloat(op7.value)) op7.value=0;
if(op8.value=="$0.00" || op8.value!=parseFloat(op8.value)) op8.value=0;

result.value=0;

result.value=parseFloat(result.value);



result.value=parseFloat(result.value)+parseFloat(op1.value)+parseFloat(op2.value)+parseFloat(op3.value)+parseFloat(op4.value)+parseFloat(op5.value)+parseFloat(op6.value)+parseFloat(op7.value)+parseFloat(op8.value);};
</script>

the calculations is good and is working. but how do I put a comma separator between thousands? also with decimals? Thanks
The administrator has disabled public write access.

How to add Comma separtors in Sum textfields. 11 years 3 months ago #26317

Please help, anyone??
The administrator has disabled public write access.

How to add Comma separtors in Sum textfields. 11 years 3 months ago #26319

  • upbm
  • upbm's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 34
  • Thank you received: 4
Hello,

Many answers on the internet, use your search engine and try!

stackoverflow.com/questions/2901102/how-...rators-in-javascript

Didier
The administrator has disabled public write access.

How to add Comma separtors in Sum textfields. 11 years 1 month ago #26892

Hi KingKongJoshua,

Were you able to fix this issue, If so could you share? I'm stumped on this one too. It would be nice to know how to implement this using the script that was provided by RSJoomla vs just randomly searching the internet to try and find something that will kinda work.

If I were a Javascript coder, it would be much easier but unfortunately I am not. (not yet anyway, going to learn)

Here's the code that I am using. I just want the person submitting the form to have the ability to use commas and decimals.

function calculateText(){

var op1=document.getElementById('ConferenceRegistration');

var op2=document.getElementById('TravelExpenses');

var op3=document.getElementById('PosterExpense');

var result=document.getElementById('Total');

if(op1.value=="" || op1.value!=parseFloat(op1.value)) op1.value=0;

if(op2.value=="" || op2.value!=parseFloat(op2.value)) op2.value=0;

if(op3.value=="" || op3.value!=parseFloat(op3.value)) op3.value=0;

result.value=0;

result.value=parseInt(result.value);

result.value=parseInt(result.value)+parseInt(op1.value)+parseInt(op2.value)+parseInt(op3.value);}
Last Edit: 11 years 1 month ago by patrick.lyons.
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!