• Resolved avcobb123

    (@avcobb123)


    LOVE LOVE LOVE your plugin. Had no idea of the power of this until I started messing around. SO THANK YOU. One last question I think for a while.

    I’m trying to output some data that isn’t nested in a text box. I’ve reviewed past forum posts and it looks like I need to do this via the HTML content box.

    I’m trying one example, but it doesn’t seem to be working for me. It was based on something else you had posted–not sure if there’s an issue with how I’m declaring the function?

    <span class="result-here"></span>
    
    var result=function(){
    if(!fieldname2) return '';
    if(.25*fieldname2<fieldname5) return "No";
    return "Yes";
    };
    
    jQuery('.result-here').html('the label of the field '+result);
    return result;
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @avcobb123

    Thank you very much for using our plugin. There are some issues in your code.

    In the “HTML Content” field, you must enter only the span tag where display the result:

    <span class="result-here"></span>

    Now, the equation must be entered into the settings of the calculated field (in the “Set Equation” attribute). And it must be similar to:

    (function(){
        var result = '';
        if(fieldname2)
        {
            if(0.25*fieldname2<fieldname5) result = "No";
            else result = "Yes";
        }
        jQuery('.result-here').html('the label of the field '+result);
        return result;
    })()

    Best regards.

    Thread Starter avcobb123

    (@avcobb123)

    Awesome thank you!

    So, that seemed to work for the first one I tried. However, I have three of these on the same page that is using mostly the same formula with different variables. I think there might be a conflict.

    I did change the class for each of the custom HTML Content fields.

    For example for the first calculated field i have something like this…i then replicated it with the same code for a new calculated field but changing ‘result-here’ to match a new css class for another HTML Custom Box. However, the two HTML Custom content boxes are showing the same exact thing, even though I can see the calculated fields have different values. Any reason there could be conflict?.

    (function(){
    var result = ”;
    if(fieldname26)
    {
    if(fieldname17==”No”) result = “Text HERE.”;
    else result = “More TEXT HERE” + (fieldname5);
    }
    jQuery(‘.result-here’).html(result);
    return result;
    })()

    Plugin Author codepeople

    (@codepeople)

    Hello @avcobb123

    Please, be sure you have inserted different class names to the different tags, for example:

    
    <span class="result-here"></span>
    <span class="result-here-2"></span>
    <span class="result-here-3"></span>
    

    And then, into the corresponding calculated fields, you should assign the results to the different tags:

    In the first equation you should use the piece of code:

    jQuery('.result-here').html(result);

    In the second equation the following code:

    jQuery('.result-here-2').html(result);

    And in the third equation this one:

    jQuery('.result-here-3').html(result);

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Outputting Calculated Field Data In HTML Content’ is closed to new replies.