added support for the scanned_notes encounter form
[openemr.git] / library / js / add_edit_event.js
blob6fa66c56bc6b8c7c8ab50af085f9141f20c649dc
1 function verify_selecteerbaar (a) {
2     var f = document.forms[0];  var a;
3     if (f.box5.value != 0) a = f.box5.value; 
4     else if (f.box4.value != 0) a = f.box4.value; 
5     else if (f.box3.value != 0) a = f.box3.value;
6     else if (f.box2.value != 0) a = f.box2.value; 
7     else if (f.box1.value != 0) a = f.box1.value;
8     else { alert('You must choose an activity.'); return false; }
10     var answer = $.ajax({
11                     url: "<?=$link?>",
12                     type: 'POST',
13                     data: 'vcode='+a,
14                     async: false
15                 }).responseText;
16     if ( answer == 'false') { alert("Please select again"); return false; }
21 ==================================================
22 DROPDOWNS FOR ACTIVITIES
24 ==================================================
26 function boxes() {
28 $(document).ready(function(){
29         var link_dbc = '../../../library/DBC_functions.php';
30         $('#box2').hide();
31         $('#box3').hide();     
32         $('#box4').hide();
33         $('#box5').hide();
34         $('#box1').bind('change', function(){
35             $('#box2').html(
36                 $.ajax({
37                     type: 'POST',
38                     url: link_dbc,
39                     data: 'code=' + $('#box1').val(),
40                     async: false,
41                 }).responseText
42             )
43             // validation for timing NOTA maybe not used anymore
44             /*valbox = $('#box1').val();
45             if ( valbox == 'act_1' || valbox == 'act_7' ) {
46                 this.form.form_duration.disabled = true; this.form.form_duration.value = 0;
47                 this.form.form_duration_indirect.disabled = true;
48                 this.form.form_duration_travel.disabled = true;
49             } else {
50                 this.form.form_duration.disabled = false;
51                 this.form.form_duration_indirect.disabled = false;
52                 this.form.form_duration_travel.disabled = false;
53             }*/
54         });
55     
56         $('#box1').bind('focus', function(){
57             $('#box2').show(); $('#box3').hide(); $('#box4').hide(); $('#box5').hide();
58         });
59         
60         $('#box2').bind('change', function(){
61             $('#box3').html(
62                 $.ajax({
63                     type: 'POST',
64                     url: link_dbc,
65                     data: 'code=' + $('#box2').val(),
66                     async: false,
67                 }).responseText
68             )
69         });
70         // if empty box, prevent the next to show
71         $('#box2').bind('focus', function(){
72         if ( $('#box2').val() != 0 ) {
73             $('#box3').show(); }
74         else {
75             $('#box3').hide();
76         }
77         $('#box4').hide(); $('#box5').hide();
78         });
79     
80         $('#box3').bind('change', function(){
81             $('#box4').html(
82                 $.ajax({
83                     type: 'POST',
84                     url: link_dbc,
85                     data: 'code=' + $('#box3').val(),
86                     async: false,
87                 }).responseText
88             )
89         });
90         // if empty box, prevent the next to show
91         $('#box3').bind('focus', function(){
92         if ( $('#box3').val() != 0 ) {
93             $('#box4').show(); }
94         else {
95             $('#box4').hide();
96         }
97         $('#box5').hide();
98         });
99         
100         $('#box4').bind('change', function(){
101             $('#box5').html(
102                 $.ajax({
103                     type: 'POST',
104                     url: link_dbc,
105                     data: 'code=' + $('#box4').val(),
106                     async: false
107                 }).responseText
108             )
109         });
110         // if empty box, prevent the next to show
111         $('#box4').bind('focus', function(){
112         if ( $('#box4').val() != 0 ) {
113             $('#box5').show(); }
114         else {
115             $('#box5').hide();
116         }
117         });
118     
119         // time validation client side
120         $('#form_save').bind('click', function(){
121             // validation for timing
122             durbox = $('#form_duration').val();
123             valbox = $('#box2').val();
124             if ( valbox == 'act_3.2' && (!parseInt(durbox, 10)) ) {
125                 alert("For selected activity you must have a value for direct time!");
126                 window.close();
127             }
128         });
135 ==================================================
136 EDITING CASE
138 ==================================================
140 function editcase() {
141 $(document).ready(function(){
142     var link_dbc = '../../../library/DBC_functions.php';
143     $('#box1').attr('disabled', true);
144     $('#addc').bind('click', function(){
145         $('#box1').attr('disabled', false);
146         $.ajax({
147         url: link_dbc,
148         type: 'POST',
149         data: 'editactiv=1',
150         async: false
151         });