2 * Javascript functions for the track anything form
5 * @link http://www.open-emr.org
6 * @author Joe Slam <trackanything@produnis.de>
7 * @copyright Copyright (c) 2014 Joe Slam <trackanything@produnis.de>
8 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
11 //-------------- checkboxes checked checker --------------------
12 // Pass the checkbox name to the function
13 function ta_report_getCheckedBoxes(chkboxName) {
14 var checkboxes = document.getElementsByName(chkboxName);
15 var checkedValue = [];
17 for (var i=0; i<checkboxes.length; i++) {
18 // And stick the checked ones onto an array...
19 if (checkboxes[i].checked) {
20 checkedValue.push(checkboxes[i].value);
25 //---------------------------------------------------------------
28 // plot the current graph
29 // this function is located here, as now all data-arrays are ready
30 //-----------------------------------------------------------------
31 function ta_report_plot_graph(formid,ofc_name,the_track_name,ofc_date,ofc_value){
34 var checkedBoxes = JSON.stringify(ta_report_getCheckedBoxes("check_col" + formid));
35 var theitems = JSON.stringify(ofc_name);
36 var thetrack = JSON.stringify(the_track_name + " [Track " + formid + "]");
37 var thedates = JSON.stringify(ofc_date);
38 var thevalues = JSON.stringify(ofc_value);
40 jQuery.ajax({ url: '../../../library/ajax/graph_track_anything.php',
42 data: { dates: thedates,
46 thecheckboxes: checkedBoxes,
47 csrf_token_form: csrf_token_js
50 success: function(returnData){
52 document.getElementById("graph" + formid),
53 returnData.data_final,
55 title: returnData.title,
59 xlabel: xlabel_translate
63 error: function (XMLHttpRequest, textStatus, errorThrown) {
64 alert(XMLHttpRequest.responseText);
65 //alert("XMLHttpRequest="+XMLHttpRequest.responseText+"\ntextStatus="+textStatus+"\nerrorThrown="+errorThrown);