Verfiy form_ss exists before trying to use it. (allows hiding SS field).
[openemr.git] / sites / default / LBF / REF.plugin.php
blob2b63233aa59f0b51a93fc1d2465f02726716b7fb
1 <?php
2 // Copyright (C) 2009 Rod Roark <rod@sunsetsystems.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 // This provides enhancement functions for the referral (REF) form.
10 // It is invoked by interface/patient_file/transaction/add_transaction.php.
12 // The purpose of this function is to create JavaScript for the <head>
13 // section of the page. This in turn defines desired javaScript
14 // functions.
16 function REF_javascript() {
17 // This JavaScript function is to reload the "Refer To" options when
18 // the "External Referral" selection changes.
19 echo "// onChange handler for form_refer_external.
20 var poptions = new Array();
21 function external_changed() {
22 var f = document.forms[0];
23 var eix = f.form_refer_external.selectedIndex;
24 var psel = f.form_refer_to;
25 var i = psel.selectedIndex < 0 ? 0 : psel.selectedIndex;
26 var pvalue = psel.options[i].value;
27 if (poptions.length == 0) {
28 for (i = 0; i < psel.options.length; ++i) {
29 poptions[i] = psel.options[i];
32 psel.options.length = 1;
33 var selindex = 0;
34 for (i = 1; i < poptions.length; ++i) {
35 var local = poptions[i].title == 'Local';
36 if (eix == 1 && !local) continue;
37 if (eix == 2 && local) continue;
38 if (poptions[i].value == pvalue) selindex = psel.options.length;
39 psel.options[psel.options.length] = poptions[i];
41 psel.selectedIndex = selindex;
46 // The purpose of this function is to create JavaScript that is run
47 // once when the page is loaded.
49 function REF_javascript_onload() {
50 echo "
51 external_changed();
52 var f = document.forms[0];
53 f.form_refer_external.onchange = function () { external_changed(); };