• Resolved fitnesspreponline

    (@fitnesspreponline)


    I want to the user to enter input to the form and click a button to show the results of the calculation. How/where can I create the OnClick event and how can I assign the output to a label?
    currently, I’m using a Calculated Field, but I prefer to use a button if possible.

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @fitnesspreponline,

    If you want to evaluate the equations only after pressing a button:

    – Activate the “Form Settings” tab.
    – Untick the checkbox: “Eval dynamically the equations associated to the calculated fields”
    – And finally to evaluate the equations, insert a button field in the form, and select as the “button type” the “Calculate” option.

    To display the equation’s result in a different tag:

    – Insert a “HTML Content” field in the form, with a tag similar to the following one as its content:

    <div class="equation-result"></div>

    – If the current equation associated to the calculated field is for example: fieldname1+fieldname2, modify it as follows:

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

    – Finally, as the calculated field is being used as auxiliary, tick the checkbox: “Hide Field From Public Page” in the calculated field’s properties.

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘How to create an OnClick Event and how to assign it to a button?’ is closed to new replies.