192 |
192 |
return false;
|
193 |
193 |
}
|
194 |
194 |
|
195 |
|
$(document).ready(function () {
|
|
195 |
$(function () {
|
196 |
196 |
$('input').focus(function(){
|
197 |
197 |
if (focussable(this)) window.focused_element = this;
|
198 |
198 |
});
|
199 |
199 |
|
200 |
|
// Lowest priority: first focussable element in form.
|
201 |
|
set_cursor_to_first_element();
|
202 |
|
|
203 |
|
// Medium priority: class set in template
|
204 |
|
var initial_focus = $(".initial_focus").filter(':visible')[0];
|
205 |
|
if (initial_focus)
|
206 |
|
$(initial_focus).focus();
|
|
200 |
// setting focus inside a tabbed area fails if this is encountered before the tabbing is complete
|
|
201 |
// in that case the elements count as hidden and jquery aborts .focus()
|
|
202 |
setTimeout(function(){
|
|
203 |
// Lowest priority: first focussable element in form.
|
|
204 |
set_cursor_to_first_element();
|
|
205 |
|
|
206 |
// Medium priority: class set in template
|
|
207 |
var initial_focus = $(".initial_focus").filter(':visible')[0];
|
|
208 |
if (initial_focus)
|
|
209 |
$(initial_focus).focus();
|
|
210 |
|
|
211 |
// special: honour focus_position
|
|
212 |
// if no higher priority applies set focus to the appropriate element
|
|
213 |
if ($("#display_row")[0] && kivi.myconfig.focus_position) {
|
|
214 |
switch(kivi.myconfig.focus_position) {
|
|
215 |
case 'last_partnumber' : $('#display_row tr.row:gt(-3):lt(-1) input[name*="partnumber"]').focus(); break;
|
|
216 |
case 'last_description' : $('#display_row tr.row:gt(-3):lt(-1) input[name*="description"]').focus(); break;
|
|
217 |
case 'last_qty' : $('#display_row tr.row:gt(-3):lt(-1) input[name*="qty"]').focus(); break;
|
|
218 |
case 'new_partnumber' : $('#display_row tr:gt(1) input[name*="partnumber"]').focus(); break;
|
|
219 |
case 'new_description' : $('#display_row tr:gt(1) input[name*="description"]').focus(); break;
|
|
220 |
case 'new_qty' : $('#display_row tr:gt(1) input[name*="qty"]').focus(); break;
|
|
221 |
}
|
|
222 |
}
|
207 |
223 |
|
208 |
|
// legacy. sone forms install these
|
209 |
|
if (typeof fokus == 'function') { fokus(); return; }
|
210 |
|
if (focus_by_name('cursor_fokus')) return;
|
|
224 |
// legacy. sone forms install these
|
|
225 |
if (typeof fokus == 'function') { fokus(); return; }
|
|
226 |
if (focus_by_name('cursor_fokus')) return;
|
|
227 |
}, 0);
|
211 |
228 |
});
|
212 |
229 |
|
213 |
230 |
$('form').submit(function(){
|
focus: Zeilenfokus in die normale Behandlung verschoben