• Resolved Amanda

    (@sparkhelp)


    If I create a form and person A completes it, then person B completes it and then person C competes it, can these 3 different submissions add together?

    So if there was a question that asked, “What country were you born in?” and the 3 different submissions were:

    Person A – Canada
    Person B – USA
    Person C – Canada

    Can the results of these different forms be added together so the results say:

    2 from Canada
    1 from USA

    ???

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

    (@codepeople)

    Hello @sparkhelp

    The process requires some of code and the shortcodes for the submissions list [CP_CALCULATED_FIELDS_RESULT_LIST]

    I’ll try to describe the process with a hypothetical example.

    Assuming the form has the id=1, and field for the countries is: fieldname123, insert a “Custom HTML” block in a page of your website, and enter as its content the following piece of code:

    
    <div class="output"></div>
    <script>
    var country_list = {}, output = '';
    [CP_CALCULATED_FIELDS_RESULT_LIST formid="1"]
    if(!('<%fieldname123_value%>' in country_list)) country_list['<%fieldname123_value%>'] = 0;
    country_list['<%fieldname123_value%>']++;
    [/CP_CALCULATED_FIELDS_RESULT_LIST]
    for(var i in country_list) output += i+': '+country_list[i]+'<br>';
    jQuery('.output').html(output);
    </script>
    

    In the previous code you should use your own form’s id, and field’s name.

    Please, look the screenshots below:

    Page’s Editor:

    Public Page:

    Best regards.

    • This reply was modified 5 years, 7 months ago by codepeople.
Viewing 1 replies (of 1 total)
  • The topic ‘Can forms add into one another’ is closed to new replies.