|
1
|
/* Javascript used to make the check-in edit screen more interactive. |
|
2
|
*/ |
|
3
|
function chgcbn(){ |
|
4
|
var newbr = document.getElementById('newbr'); |
|
5
|
var brname = document.getElementById('brname'); |
|
6
|
var checked = newbr.checked; |
|
7
|
var x = brname.value.trim(); |
|
8
|
if( !x || !newbr.checked ) x = newbr.getAttribute('data-branch'); |
|
9
|
if( newbr.checked ) brname.select(); |
|
10
|
document.getElementById('hbranch').textContent = x; |
|
11
|
cidbrid = document.getElementById('cbranch'); |
|
12
|
if( cidbrid ) cidbrid.textContent = x; |
|
13
|
} |
|
14
|
function chgbn(){ |
|
15
|
var newbr = document.getElementById('newbr'); |
|
16
|
var brname = document.getElementById('brname'); |
|
17
|
var x = brname.value.trim(); |
|
18
|
var br = newbr.getAttribute('data-branch'); |
|
19
|
if( !x ) x = br; |
|
20
|
newbr.checked = (x!=br); |
|
21
|
document.getElementById('hbranch').textContent = x; |
|
22
|
cidbrid = document.getElementById('cbranch'); |
|
23
|
if( cidbrid ) cidbrid.textContent = x; |
|
24
|
} |
|
25
|
function chgtn(){ |
|
26
|
var newtag = document.getElementById('newtag'); |
|
27
|
var tagname = document.getElementById('tagname'); |
|
28
|
newtag.checked=!!tagname.value; |
|
29
|
} |
|
30
|
(function(){ |
|
31
|
document.getElementById('newbr').onchange = chgcbn; |
|
32
|
document.getElementById('brname').onkeyup = chgbn; |
|
33
|
document.getElementById('tagname').onkeyup = chgtn; |
|
34
|
}()); |
|
35
|
|