CalcBuilder Forum

Conditional Output

User 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

User 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 40 hours

With the peace of mind of having a professional team at your service (20% discount)

Buy now!
...
List Manager

Build different lists for your site

Buy now!