Support » Plugin: Calculated Fields Form » CFF Fields inline with text

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

    (@codepeople)

    Hello @sixlinksrule

    If you are referring to display the equation’s result as part of a paragraph or similar, yes, that’s possible, but you should use the calculated field as auxiliary, and display the result into another field.

    For example, assuming your current equation is: fieldname1+fieldname2 and you want to display it embedded into the following text:

    The cost of service is: <result here>, thank you very much.

    First, insert a “HTML Content” field in the form with a piece of code similar to the following one as its content:

    <p>The cost of service is: <span class="result-here"></span>, thank you very much.</p>

    Second, edit the equation as follows:

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

    Finally, as the calculated field is being used as auxiliary, you can tick the checkbox in its settings for hiding the field from the public form.

    Best regards.

    Thread Starter sixlinksrule

    (@sixlinksrule)

    Thank you for your reply. A further question on this, can the field label be placed inline with the field instead of above the field?

    So instead of:

    Number
    [_________]

    we would have:

    Number [_________]

    • This reply was modified 2 years, 9 months ago by sixlinksrule.
    Plugin Author codepeople

    (@codepeople)

    Hello @sixlinksrule

    Please, pay attention to the “Label Placement” attribute in the “Form Settings” tab:

    Best regards.

    Thread Starter sixlinksrule

    (@sixlinksrule)

    Thank you, my bad.

    Thread Starter sixlinksrule

    (@sixlinksrule)

    Regarding your first reply above, how would we separately embed the entered values for fieldname1 and fieldname2 in a block of text as in the following example:

    The customer has advised having a monthly salary of <fieldname1 value> and monthly expenses of <fieldname2 value> respectively. Based on this, our advice would be as follows…..

    • This reply was modified 2 years, 9 months ago by sixlinksrule.
    Plugin Author codepeople

    (@codepeople)

    Hello @sixlinksrule

    You simply should replicate the same code:

    
    The customer has advised having a monthly salary of <span class="result-1"></span> and monthly expenses of <span class="result-2"></span> respectively. Based on this, our advice would be as follows….
    

    The equation associated to the fieldname1 would be similar to:

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

    and the equation associated to the fieldname2

    
    (function(){
    var result = fieldname9+fieldname20;
    jQuery('.result-2').html(result);
    return result;
    })()
    

    Note that the equations are hypothetical, you only should pay attention to the way the values are displayed in their corresponding span tags using the class names assigned to them.

    Best regards.

    • This reply was modified 2 years, 9 months ago by codepeople.
    Thread Starter sixlinksrule

    (@sixlinksrule)

    Can you please confirm, would the same approach be used when the Field say <%fieldname9%> to be embedded is of Type Single Line Text? For example, when the Single Line Text is collecting a customer name.

    Form Field captures Customer Name

    Customer Name: [Bob Brown]

    Entered Customer Name is Embedded in subsequent paragraph as in this example

    The Customer, Bob Brown, has advise the following financial details:

    • This reply was modified 2 years, 9 months ago by sixlinksrule.
    Plugin Author codepeople

    (@codepeople)

    Hello @sixlinksrule

    If the field is not a calculated field, you can get its value from the equation associated to a calculated field, and display it as part of the paragraph, just like the previous examples. There are no differences in the process.

    – Get values of fields, from the equations.
    – Display the values into the paragraph as previously.

    Best regards.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘CFF Fields inline with text’ is closed to new replies.