Calculation with comma

Calculate with comma decimal separators in ChronoForms.

Overview

The calculation code uses JavaScript functions that interpret numbers with dots, not commas.
Replace parseInt with parseFloat in your JavaScript to handle decimal numbers, and ensure your input values use a dot or properly format the string for parsing.

Answered
ChronoForms v6
pa patrick.h 29 Jun, 2018
Hi,

how can i calculate with comma in my CF6?
The code (Code from https://www.chronoengine.com/faqs/74-chronoforms/chronoforms6/5314-creating-a-calculation-form-in-chronoforms6)
$("#field1,#field2").on("change", function(){
	$("#total").val(parseInt($("#field1").val()) + parseInt($("#field2").val()));
});
works fine but unfortunately only with dot instead of comma

I use "parseFloat" instead of parseInt
$("#forderungen-berechnen").on("click", function(){
$("#forderungen-offen").val(parseFloat($("#forderungen-betrag").val()) - parseFloat($("#forderungen-gezahlt").val()));
});
he healyhatman 19 Jul, 2018
That's a JQuery question mate not a Chronoforms or PHP question. Try Google.
This topic is locked and no more replies can be posted.