Support » Plugin: Calculated Fields Form » How to Send Output to a HTML Page?

  • Resolved yourlaks


    The statuts show in the input field. However, Is it possible to display weight status value in the html text instead of an input filed.

    My code:

    var average = fieldname4;
    if(average<18.5) return ‘Underweight’;
    if(average<25) return ‘Healthy’;
    return ‘Overweight’;

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople


    Hello @yourlaks

    Yes, of course. That’s possible.

    I assume you have inserted an “HTML Content” field or similar with a tag with the class name status-here, and you want to display the equation’s results into this tag.

    Please, edit the equation as follows:

    var result = 'Overweight', average = fieldname4;
    if(average<25) result = 'Healthy';
    if(average<18.5) result = 'Underweight';
    return result;

    The return instruction returns the equation’s value and moves the execution outside the equation’s code. So, it must be after the assignment of the value to the status-here tag. Furthermore, please, pay attention to the order of the conditional statements. I’m assigning the values to the result variable from the most general to the most restrictive.

    Best regards.

    Thread Starter yourlaks


    You’re a legend!

    Thank you very much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.