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

    (@codepeople)

    Hi,

    Yes of course, I’ll try to explain a possible implementation through an example. I’ll assume that your form includes two number fields: fieldname1 and fieldname2, and you want to display the text: “Excellent result: xyz” if fieldname1+fieldname2 is bigger than 100, “Good result: xyz” if fieldname1+fieldname2 is bigger than or equal to 50, and “Bad result: xyz” in other cases.

    First, I’ll insert a “HTML Content” field in the form, and enter as its content the div tag below, where will be displayed the text:

    <div id="result"></div>

    and then the equation associated to the calculated field would be as follows:

    (function(){
    var sum = fieldname1+fieldname2;
    var text  = '';
    if( sum > 100 ) text = 'Excellent result: '+sum;
    else if( sum >= 50 ) text = 'Good result: '+sum;
    else text = 'bad result: '+sum;
    
    jQuery('#result').html( text );
    })()

    Please, uses a similar logic in your project.

    If you don’t want to display the calculated field in the form, you simply should untick the checkbox: “Hide Field From Public Page” in the field’s attributes.

    Best regards.

    Thread Starter koen123

    (@koen123)

    Thanks for your quick reply.
    It works!

    Best regards,

    Koen

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Advice depending on score’ is closed to new replies.