• 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: Form Calculation from Checkboxes and Value in Euro

Form Calculation from Checkboxes and Value in Euro 12 years 7 months ago #19169

So heres my problem, I have no idea how Javascript works and the 2 Form examples dont show/include how to use checkboxes as a value input.

So heres my Form and Question:

radio
15.50 | desc 1
25.50 | desc 2

checkbox1
1.30 | desc1
2.50 | desc2
3.60 | desc3

checkbox2
4.30 | desc1
4.50 | desc2
4.60 | desc3
4.80 | desc4

etc

Total xx,xx€

So my question is, is it possible to calculate radio & check boxes (onclick) then change the total from a number to an euro sum? (dot to comma) and if it is how can I do this? cause the examples only use raido, singular checkboxes and a normal total value.

thank you in advance and sorry about the english it has been a while since ive used it! :)

Daniel
The administrator has disabled public write access.

Re: Form Calculation from Checkboxes and Value in Euro 12 years 7 months ago #19178

Update

So I have set up everything so far that when a new item is selected the price (total) is also changed, My problem and question is how can I convert the decimal separater(from a dot to a comma as well as have 2 decimal places (eg 10.50 needs to be 10,50)), as everytime i try to add a .toFixed(2); it breaks the javascript. Im currently trying to go from one field that shows the total that and then one that shows the total with comma and decimal place...

Trust me I have searched, ive tryed many differnt things but I just cant get it to work :(

Heres the code behind the form
<script language="JavaScript">
function calculateRadio(){
 
var op1=document.getElementsByName('form[senfe][]');
var op2=document.getElementsByName('form[oel][]');
var result=document.getElementById('Total');
 
result.value=0;
result.value=parseInt(result.value);
for(i=0;i<op1.length;i++)
if(op1[i].checked) result.value=parseFloat(result.value)+parseFloat(op1[i].value);
for(i=0;i<op2.length;i++)
if(op2[i].checked) result.value=parseFloat(result.value)+parseFloat(op2[i].value);
 
addComma();
}
 
function addComma(){
 
var str=Total.value;
var n=str.replace(/\./g, ",");
comma.value=n;}
 
</script>

And a link to the form http://idee-genuss.de/index.php?option=com_rsform&formId=13

Its not pretty, wanted to get it working before I spent to much time on it.

:o
The administrator has disabled public write access.

Re: Form Calculation from Checkboxes and Value in Euro 12 years 6 months ago #19469

  • Toad78
  • Toad78's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 27
Greetings!

I noticed that you got your form to work!

How were you able accomplish this with check boxes?
The administrator has disabled public write access.

Re: Form Calculation from Checkboxes and Value in Euro 12 years 2 months ago #21596

Hello,

I have my form same promlem than you :) Do you got any good solve it?
Function cut desimal off.

BR

Pekka
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!