Forum


Calc Builder Support

Calc Builder support
Forums
Public write access is disabled. Please login

YES/NO (checkBOX) - VALUE number 04.12.2013 21:39

Hello.

My calculator consists of sets "multiple->YES/NO".
payment must occur by summing the checkboxes (YES/NO) field
($result=#checkbox1+checkbox2+....checkboxN)

But the FIELD, (YES/NO - type), has no option where you can enter a value.

How can I set the "number" of the "field"?
(Option list)
Multivalues
Actions: Add Delete All-------------------------Name_______Value_____
SQL Actions: Add Del
CSV Actions: Add

Re: YES/NO (checkBOX) - VALUE number 05.12.2013 09:39

Hi,
checkboxes have value "Y" when selected, that you can use to confirm if user checked or not the option, but you can give them a numeric value at the code, you don't need to overwritte the default value of the check. Here a couple of examples:

Field: check0- typed YES/NO
Field: check1- typed YES/NO


//at the code, we'll create values for each check, but we give them different name:

$check0value=5;
$check1value=8;

//if you want to calculate the sum of the two options, regardeless of whether are selected or not:

$result=$check0value+$check1value;


//and now, if you want to sum ONLY the selected values:

$result=0;

//if check0 is selected, add its value to result
if($check0=="Y"){
$result=$result+$check0value;

}



//if check1 is selected, add its value to result
if($check1=="Y"){
$result=$result+$check1value;

}

//you will get at $result the sum of the options


Hope this helps, regards
Moonsoft Team
www.moonsoft.es
Are you satisfied with our products/services/support?
Please help us to keep improving, add a review at  joomla extensions site and  magento connect

Our clients' feedback