CalcBuilder Forum

if else fuction

User todanai 2015-02-05 10:00:14

Dear all, I have the fuction. If epan>2 then I want to see the results in the result layout else I want to have an error message asking user to insert new values. Unfortunately I don't know what to put after "else"

This is the half of the code:

if ($epal > "2") {
else {
I want to see a message error or a pop up error!!!??

Moonsoft support 2015-02-05 11:18:51

if you were printing a single result, like $result, you could use that approach to set $result with the if/else structure:




but looking at your code, seems you are calculating several results, so we'd use this solution instead:

At your exit layout, create the two sections (real results, and error message). Enclose each one inside a div and set a different style for each one:

//real results

...div style="display:##displayreal##"

//here your result section..close div

//error section

..div style="display:##displayerror##"

//here your error section...close div

and now you can set at the code the display of each section according to your condition:






Please let us know if you need further help with this.

Thanks, regards


Create dynamic calculators

Buy now!
Support/development 40 hours

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

Buy now!