diff --git a/index.php b/index.php index 73399de..49030f2 100644 --- a/index.php +++ b/index.php @@ -20,6 +20,9 @@ .done(function(data) { $("#details-form").html(data); // load form fields $("#datepicker").datepicker(); //trigger datepicker + + // for counts with more than one location, display + // sum of all location counts $(".counts").bind("keyup", function () { var total = 0; $(".counts").each(function(e) { @@ -28,9 +31,10 @@ }); //end each count $("#sum-counts").html(total); }); //end keyup - }); - } - }); //end on click delete-link + + }); //end js-actions on successful AJAX load + } //end else if there's an initiative ID + }); //end on selection of initiative from pulldown }); //end document ready diff --git a/load_fields.php b/load_fields.php index 3771604..12813dd 100644 --- a/load_fields.php +++ b/load_fields.php @@ -16,7 +16,6 @@

Counts by location

-
Total Counts:

diff --git a/scripts.php b/scripts.php index 59ec4e8..271a35c 100644 --- a/scripts.php +++ b/scripts.php @@ -42,12 +42,17 @@ function GetLocations($initiative) { $location_inputs = ""; $q = "SELECT `location`.`id` as loc_id,`location`.`title` as loc_title from `location`,`initiative` where `location`.`enabled` = '1' and `location`.`fk_parent` = `initiative`.`fk_root_location` and `initiative`.`id` = '$initiative'"; $r = mysql_query($q); + $field_count = mysql_num_rows($r); while ($myrow = mysql_fetch_assoc($r)) { extract($myrow); $locs[$loc_id] = $loc_title; $location_inputs .= "\n"; $location_inputs .= "
\n"; } //end while locations + if ($field_count > 1) { + $location_inputs .= '
Total Counts:
'; + } + return($location_inputs); } //end function GetLocations