CalcBuilder Forum

Multiple option value

User anonymous 2011-10-21 14:23:21

Hello, I purchased Calc Builder and am enjoying working with it. Can you
please give me an example of how you code an 'array' (for the multiple
option function).
Thank you,

Moonsoft support 2011-10-21 14:23:44

Hello,

In multiple option variable you can get an array of values selected. We
attached a simple example, ready to import in Calc Builder, to help you to see better. Please check download section (examples) of Calc builder

Hope this helps.

Moonsoft support 2013-10-28 19:42:18

Hello,
what is the name of the example with multiple option please?
regards

Moonsoft support 2013-10-28 19:54:25

Hello,
you can see how multiple option is recovered at the example

Recover selected values from all input types

Some quick tips:

For multiple option, what you get is an array of values, so


$multiple would be the first value selected

$multiple the second, etc.

if you need to know how many options are selected

count($multiple)

will give you the number.


And finally

$result=0;
for($i=0;count($multiple)>$i;$i++){

$result=$result+$multiple;
}

Will add at the $result every value selected (if numeric).





Hope this helps

Edited by MSTeam - 28.10.2013 19:55

Moonsoft support 2013-10-28 20:02:29

Hello,
I'm not a developer and I spent a hole day to try to understand Calc Builder but no results for me

I want something like this


Multiple option

Analysis:
-- Option1 (that have cost 50 + comment: come at 7AM)
-- Option2 (that have cost2 70 + comment2: come at 8AM)
-- Option3 (that have cost3 80 + comment3: come at 9AM)

Radio button
-- Option1 (that don't give a discount)
-- Option2 (that change price to -5$ or 5% for example)


Output :

You choose :
(radio option) Option2

Toy choose : (multiple choice)
option 1 costs 50$ -5$ = 45$ (you should come at 7AM)
option 3 costs 80$ -5$ = 75 $ (you should come at 9AM)

Total cost : 120 $

Best regards

Edited by moon_1301 - 28.10.2013 20:03

Moonsoft support 2013-10-28 20:32:48

Hi,
already answered at the helpdesk, please check your ticket regarding this issue. We can continue there if you have further questions because it's easier to share code.

In case it may help others, in case you need to check if one value has been selected at a multiple option, here is the code needed, let's say the multiple field is called 'multiple', and you want to check if value 'VALA' has been selected:

if (in_array("VALA", $multiple)) {

//your code here.VALA has been selected


}


Regards

...
Support/development 10 hours

Get a bigger amount of hours for more complex tasks and get a 10% discount

Buy now!
...
List Manager

Build different lists for your site

Buy now!