CalcBuilder Forum

Check Results

User Panos512 2015-04-08 12:53:27


I would like to validate results.
For example if a result value is greater than 100 i need to pop a window.
I set up javascript on "Executed after calculate execution" tab like this:

var result=cb_getValue('IRR'); //IRR is a php value from code section
if(result>100) window.alert("ERROR");

But it doesen't seem to work.

Is there anything i can do to get result variable?

Thank you

Moonsoft support 2015-04-08 16:19:06

in case you want to handle your calculator results when you're back on the page, you need to 'print' the value in order to allow javascript to read it and execute any action.

You can write a hidden field at your ouput section (please replace for the html tags)

So at the javascript section you can recover this field value at the

"Executed after calculate execution" tab:

var result=CB("#myresult").val();

//and launch here the proper actions according to the result.

Hope this helps, regards

Support/development 10 hours

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

Buy now!

Create dynamic calculators

Buy now!