• Resolved bobbiedoo

    (@bobbiedoo)


    How can I make a field show an answer until after clicking calculate?

    For example, using the Pregnancy Calculator: I want the Conception Date and Due Date to show only when a Calculate Button is clicked.

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

    (@codepeople)

    Hello @bobbiedoo

    The process is very simple:

    – Assign the predefined class name: hide
    to the fields you want hide until the button be pressed.

    Note: enter the word: hide
    into the “Add CSS Layout Keywords” attribute, in the settings of these fields.

    – Edit the onclick event of the calculate button as follows:

    
    jQuery('.hide').removeClass('hide');
    

    Note 2: there is an attribute in the settings of button fields for entering the onclick event.

    and that’s all
    Best regards.

    Thread Starter bobbiedoo

    (@bobbiedoo)

    Thanks, it worked.

    Another question:

    How can I display the content of a calculated field in section break or summary such as:

    Note: Your estimated due date is [fieldname6]. However, your actual due date could be 10 days before or after this estimated date.

    Is this possible?

    Plugin Author codepeople

    (@codepeople)

    Hello @bobbiedoo

    Yes of course, that’s possible and the process is very simple.

    I’ll try to describe it with a hypothetical example.

    Assuming your current equation is: fieldname1+fieldname2

    – Insert a “HTML Content” field in the form where will be displayed the solution as sentence, and enter as its content:

    
    <div>Note: Your estimated due date is <span class="result-here"></span>. However, your actual due date could be 10 days before or after this estimated date.</div>
    

    – Finally, edit the equation associated to the calculated field, as follows:

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

    Another possible alternative, that not requires to edit the equation, would be insert as the content of the “HTML Content” field the following piece of code:

    
    <div>Note: Your estimated due date is <span class="result-here"></span>. However, your actual due date could be 10 days before or after this estimated date.</div>
    <script>
    jQuery(document).on('change', '[id *="fieldname6_"]', function(){jQuery('.result-here').html(this.value);});
    </script>
    

    Note: if you want hide the calculated field, because its result is displayed as part of the sentence, you simply should tick the checkbox: “Hide Field From Public Page” in its settings.

    Best regards.

    Thread Starter bobbiedoo

    (@bobbiedoo)

    Perfect. Thanks so much. Your plugin is the best. I look forward to purchasing the Pro Version.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘I need your help’ is closed to new replies.