• 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: [SOLVED] Radio group calculation x number field

[SOLVED] Radio group calculation x number field 15 years 9 months ago #8039

Hello,

I am new in calculation form and I'm not so skill (not problem with other kind of forms). It's clear how I can manage it with fix numbers (hidden) or with numbers fields, but I don't understand how to combinate number fields with radio group.

I need to make a simple automatic offer module with the follow informations:

radio button 1 with:
- 50|description 1
- 45|description 2
- 40|description 3
*
radio button 2 with:
- |description 1
- 1,1|description 2
- 1,2|description 3
*
number field1
=
Offer

Could you help me? Thank you.
Last Edit: 15 years 9 months ago by cristian.rossato.
The administrator has disabled public write access.

Re:Radio group calculation x number field 15 years 9 months ago #8061

I thank very much Bogdan Catana for suggesting me for the solution.

He suggested me the follow solution that it is ok for add a free input number for a valum from a group radio:
<script language=javascript>
function calculate()
 
{
 
var op1=document.getElementById('field1');
 
var op2=document.getElementsByName('form[radio1]');
 
var result=document.getElementById('result');
 
result.value=0;
 
result.value=parseInt(result.value);
 
result.value=parseInt(result.value)+parseInt(op1.value);
 
for(i=0;i<op2.length;i++)
if(op2[i].checked) result.value=parseInt(result.value)+parseInt(op2[i].value);
 
alert(result.value);
 
return false;
}
</script>

Here I share my script for multiplicate a free input number for a valum from a group radio:
<script language=javascript>
function calculate()
 
{
 
var op1=document.getElementById('field1');
 
var op2=document.getElementsByName('form[radio1]');
 
var result=document.getElementById('result');
 
result.value=0;
 
result.value=parseInt(result.value);
 
for(i=0;i<op2.length;i++)
if(op2[i].checked) result.value=(parseInt(op2[i].value))*(parseInt(op1.value));
 
alert(result.value);
 
return false;
}
</script>
Last Edit: 15 years 9 months ago by cristian.rossato.
The administrator has disabled public write access.

Re:Radio group calculation x number field 15 years 9 months ago #8062

Now I have only one small problem: when I push the calculate button it's showed a warning window with the value of calculation also if the data are wrong in the form. If it is all ok you have always to confirm this window.

It's possible to take away it? Thank you.

Attachments:
Last Edit: 15 years 9 months ago by cristian.rossato.
The administrator has disabled public write access.

Re:Radio group calculation x number field 15 years 9 months ago #8067

It was very simple to take away the alert window...

I had to take away the follow part of code:
alert(result.value);

Thanks to Bogdan for his support!
The administrator has disabled public write access.

[SOLVED] Radio group calculation x number field 8 years 3 months ago #36367

HI
I have used this script sometimes ago and now I'd like to used it again but it doesn't work.
The field that shows the result of calculation is empty.
Can you help me?
this is the url for the form.
www.rossatogroup.com/index.php?option=co...iew=rsform&formId=20
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!