• Resolved szynol

    (@szynol)


    Hi,
    I have use your plugin couple of days and it’s awesome πŸ™‚ BUt have some problem. I want to display some of calculations results as a part of paragraph text… Something like here:

    <p>Lorem ipsum dolor <%fieldname11%> sit amet <%fieldname56%> consectetur adipiscing elit <%fieldname7%> <br/> <%fieldname59%> Suspendisse <%fieldname9%></p>

    Can you help mewith something like that?

    EDIT
    Ofcourse this message will be displayed below form and will change, with calculation changes.
    And i will have separate messages that will display conditionally, but will use this same callculation fields.

    • This topic was modified 4 years, 9 months ago by szynol.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @szynol

    The solution would be to use the calculated fields as auxiliary (to calculate the results), but display the results into a third field.

    For example, you can to insert a “HTML Content” field in the form with the following piece of code as its content:

    
    <p>Lorem ipsum dolor <span class="result-1"></span> sit amet <span class="result-2"></span> consectetur adipiscing elit <span class="result-3"></span> <br/> <span class="result-4"></span> Suspendisse <span class="result-5"></span></p>
    

    and then, assuming the equation of the fieldname11 is for example: fieldname1+fieldname2, edit it as follows:

    
    (function(){
    var result = fieldname1+fieldname2;
    jQuery('.result-1').html(result);
    return result;
    })()
    

    and repeat the process with the other calculated fields but using the corresponding class name for the span tag where display the result: result-2, result-3, ….

    Finally, as the calculated fields are being used as auxiliary, you can tick the checkbox on their settings for hiding the fields from the public form.

    There is another alternative even simpler:

    Enter as the content of the “HTML Content” field the tag:

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

    and insert an additional calculated field in the form with the equation:

    
    (function(){
    var  p = 'Lorem ipsum dolor '+fieldname11+' sit amet '+fieldname56+' consectetur adipiscing elit '+fieldname7+' <br/> '+fieldname59+' Suspendisse '+fieldname9;
    
    jQuery('.result-here').html(p);
    return p;
    })()
    

    and of course, hiding this calculated field.

    Best regards.

    Thread Starter szynol

    (@szynol)

    Hi,
    thanks for quick answer:) I’ll try these options. Personally – second one looks awesome:)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying multiple fields in paragraph’ is closed to new replies.