• 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: checkbox auto calculate in another fileld :( :(

checkbox auto calculate in another fileld :( :( 12 years 3 months ago #16019

hi.
I want do this and i cant!
problem 1 :
3 checkbox with 100,200,300 values.
and when i checked any of them. total shown in another input box.

prob 2:
a project like prev but by just one check box with 3 valeu: 100,200,300


notes: i find a example "Custom PayPal form example" that do this, but it use a Quantity field.
i dont need Quantity and i want to add checkbox values just and just!

thanks
:(
The administrator has disabled public write access.

Re: checkbox auto calculate in another fileld :( :( 12 years 3 months ago #16055

  • andreic
  • andreic's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 722
  • Thank you received: 59
Hello,

1.
This can be achieved by creating a function that calculates the total with the items from the checkbox group. A similar example can be found on our demo server:

demo.rsjoomla.com/calculation-form-example

In order to perform the calculation when the option is selected you need to use the following line in the "Additional attributes" of the checkbox fields:

onclick="total_function_name();"

2.
You will basically use the same method/function, but you will need to make some adjustments in order to calculate the total from a single checkbox instead of 3 different ones.
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.
The following user(s) said Thank You: behsoftinfo

Re: checkbox auto calculate in another fileld :( :( 12 years 3 months ago #16075

thanks for your answer. i saw calculate example of server. it was cool. but i can not understand how can i do my idea!
in radio group and textbox and lists the codes are useful but i dont know how can i use that for checkboxes.
my idea:
3 checkbox and a total input box.
default value of total is 0.

problem is here!
when i click on any check box default value in it add to total var and shown in editbox.

<script type="text/javascript">
function calculateRadio()
{
var op1=document.getElementsByName('form[checkbox1]');
var op2=document.getElementsByName('form[checkbox2]');
var result=document.getElementById('Total2');

result.value=0;

result.value=parseInt(result.value);

for(i=0;i<op1.length;i++)
if(op1.checked) result.value=parseInt(result.value)+parseInt(op1.value);

for(i=0;i<op2.length;i++)
if(op2.checked) result.value=parseInt(result.value)+parseInt(op2.value);
}

it doesnt work. i change the code according to the "paypal" rsjoomla template but it dont work again!


best guide was paypal example:

i make some change in it but it work just for 8 product and my 9th and more product doesnot work with this codes.
my main is when i click 1-8th check box it default value add to total. but 9th and more product value does not add to total.
some of my changes was:

var products = new Array("Product10","Product20","Product30","Product40","Product50","Product60","Product70","Product80","Product90","Product100");
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!