Lines 50-55
use C4::Output;
Link Here
|
50 |
# into the event data parameter; Focus e.g. uses that one again by looking at |
50 |
# into the event data parameter; Focus e.g. uses that one again by looking at |
51 |
# the variable event.data.id. |
51 |
# the variable event.data.id. |
52 |
# |
52 |
# |
|
|
53 |
# Comments in JavaScript must be multi-line style ( /* ... */ ) in case |
54 |
# the JavaScript block is collapsed by the template |
55 |
# |
53 |
# Do not use the perl variable $id to extract the field value. Use variable |
56 |
# Do not use the perl variable $id to extract the field value. Use variable |
54 |
# event.data.id. This makes a difference when the field is cloned or has |
57 |
# event.data.id. This makes a difference when the field is cloned or has |
55 |
# been created dynamically (as in additem.js). |
58 |
# been created dynamically (as in additem.js). |
Lines 59-65
my $builder= sub {
Link Here
|
59 |
my $id = $params->{id}; |
62 |
my $id = $params->{id}; |
60 |
|
63 |
|
61 |
return qq| |
64 |
return qq| |
62 |
<script type="text/javascript"> |
65 |
<script> |
63 |
function Focus$id(event) { |
66 |
function Focus$id(event) { |
64 |
if( \$('#'+event.data.id).val()=='' ) { |
67 |
if( \$('#'+event.data.id).val()=='' ) { |
65 |
\$('#'+event.data.id).val('EXAMPLE:'); |
68 |
\$('#'+event.data.id).val('EXAMPLE:'); |
Lines 68-81
function Focus$id(event) {
Link Here
|
68 |
|
71 |
|
69 |
function MouseOver$id(event) { |
72 |
function MouseOver$id(event) { |
70 |
return Focus$id(event); |
73 |
return Focus$id(event); |
71 |
// just redirecting it to Focus for the same effect |
74 |
/* just redirecting it to Focus for the same effect */ |
72 |
} |
75 |
} |
73 |
|
76 |
|
74 |
function KeyPress$id(event) { |
77 |
function KeyPress$id(event) { |
75 |
if( event.which == 64 ) { // at character |
78 |
if( event.which == 64 ) { /* at character */ |
76 |
var f= \$('#'+event.data.id).val(); |
79 |
var f= \$('#'+event.data.id).val(); |
77 |
\$('#'+event.data.id).val( f + 'AT' ); |
80 |
\$('#'+event.data.id).val( f + 'AT' ); |
78 |
return false; // prevents getting the @ character back too |
81 |
return false; /* prevents getting the @ character back too */ |
79 |
} |
82 |
} |
80 |
} |
83 |
} |
81 |
|
84 |
|
Lines 92-98
function Change$id(event) {
Link Here
|
92 |
function Click$id(event) { |
95 |
function Click$id(event) { |
93 |
var fieldvalue=\$('#'+event.data.id).val(); |
96 |
var fieldvalue=\$('#'+event.data.id).val(); |
94 |
window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=EXAMPLE.pl&index=\"+event.data.id+\"&result=\"+fieldvalue,\"tag_editor\",'width=700,height=700,toolbar=false,scrollbars=yes'); |
97 |
window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=EXAMPLE.pl&index=\"+event.data.id+\"&result=\"+fieldvalue,\"tag_editor\",'width=700,height=700,toolbar=false,scrollbars=yes'); |
95 |
return false; // prevents scrolling |
98 |
return false; /* prevents scrolling */ |
96 |
} |
99 |
} |
97 |
</script>|; |
100 |
</script>|; |
98 |
}; |
101 |
}; |