Hello,
Is it possibe to use Enter Key instead of Tab Key in Add or Edit dialog forms for next input focus or in phpgrid columns for next column focus ?
Regards…
ollowing JS code will emulate ENTER as TAB. Put this script code before `echo $out`;
<script>
var opts = {
'loadComplete': function () {
$('body').on('keydown', 'input, select, textarea', function(e) {
var self = $(this)
, form = self.parents('form:eq(0)')
, focusable
, next
;
if (e.keyCode == 13) {
focusable = form.find('input,a,select,button,textarea').filter(':visible');
next = focusable.eq(focusable.index(this)+1);
if (next.length) {
next.focus();
} else {
form.submit();
}
return false;
}
});
}
};
</script>
…
<div style="margin:10px">
<?php echo $out?>
</div>
On form dialog, this is alternate code.
<script>
var opts = {
'loadComplete': function () {
$('body').on('keydown', 'input, select, textarea', function(e) {
var self = $(this)
, form = self.parents('form:eq(0)')
, focusable
, next
;
if (e.keyCode == 13) {
focusable = form.find('input,a,select,button,textarea').filter(':visible');
next = focusable.eq(focusable.index(this)+1);
if (next.val() != undefined) {
next.focus();
} else {
$('#sData').click();
}
return false;
}
});
}
};
</script>