PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

RGFormsModel::get_form_counts is not updating when form entries are edited

  1. agelfand

    A few months ago I created a form for a client where one field in the form accepts an integer, and the following script counts up the values of this form field from all the submitted entries and echoes it on a text widget I made.

    function raoc_counter($atts, $content = null) {
    	$summary = RGFormsModel::get_form_counts(1);
    	$today = date("F j, Y");
            return '<div class="racount"><div class="racount1">There have been</div><div class="racount2">'.$summary["total"].'</div><div class="racount3">RANDOM ACTS OF CULTUREas of '.$today.'Count with us to 1,000!</div>';
    add_shortcode("raoc", "raoc_counter");

    See the How Many Random Acts widget on this page:

    When the client goes into the existing form entries and changes the # in that field, the count should increase or decrease appropriately. But it isn't doing anything at all right now. Is there a problem with my code? Anyone see anything obvious that I'm missing? Client says it was working earlier and now it's not.

    Posted 8 years ago on Thursday April 28, 2011 | Permalink
  2. The RGFormsModel::get_form_counts(1) function is returning the total number of entries, not the total of the integer in any field.

    Something like this might be better suited to your end goal.

    Posted 8 years ago on Thursday April 28, 2011 | Permalink