Use Enter Key instead of Tab Key in Add or Edit dialog forms and in phpgrid columns for next input

QuestionsUse Enter Key instead of Tab Key in Add or Edit dialog forms and in phpgrid columns for next input
toki asked 11 years ago

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…

4 Answers
Abu Ghufran answered 11 years ago

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>

toki answered 11 years ago

Abu,

I realy thank you very much.

Regards…

toki answered 11 years ago

Abu,

It works with no problem.

Thanks and regards…

Abu Ghufran answered 11 years ago

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>

Your Answer

6 + 13 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?