CalcBuilder Forum

Conditional Output

Usuario moon_677 2012-09-19 12:32:32

I have created a couple of calculators for a site but my client would like to output a text line rather than the normal output when one of the results is negative.

I had a quick look at the 'Javascript events' but I am not sure if this is the area where I should be looking.

I see that in the guide there is a 'Ship costs' calculation that used Java but I can't find it to download and look at.

Thank you for a great component.

Moonsoft support 2012-09-19 15:28:25

Hello,
in fact, you don't need to add javascript code for that. You can create conditional output using the default code section where you have placed your calculations. Once you have finished with the math (and before making number formatting, if any), you can handle your variable (for ex, $result), using the conditional, this way:

if(0>$result){
$result="This is the new output";
}


Hope this helps, regards

Edited by MSTeam - 19.09.2012 15:29

Usuario moon_677 2012-09-21 10:51:37

Thanks very much.

I am beginning to learn that there is very little that I will not be able to do with your component.

Fantastic!

Moonsoft support 2012-09-21 11:10:07

That's the idea ;)

Great it helped you!
Regards

...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!
...
CalcBuilder

Create dynamic calculators

Buy now!