Hi,
This is the script, i have generated but anyhow, it jumps to next key and
tries to validate and the it looses focus.
Another problem is, my script only work for a certain kind of input
fields. is there a way to get all the input fields when i add it into
web2py_ajax.html
<script type="text/javascript">
$(document).ready(function(){
textboxes = $("input.double");
$(".double").click(function(){
if ($.browser.mozilla) {
$(textboxes).keypress (checkForEnter);
}
else {
$(textboxes).keydown (checkForEnter);
}
});
});
function checkForEnter (event) {
if (event.keyCode == 13) {
currentBoxNumber = textboxes.index(this);
if (textboxes[currentBoxNumber + 1] != null) {
nextBox = textboxes[currentBoxNumber + 1]
nextBox.focus();
nextBox.select();
}
else{
event.preventDefault();
return false;
}
}
}
</script>
Am Montag, 20. August 2012 21:51:10 UTC+2 schrieb Anthony:
>
> Either directly in layout.html or in a JS file loaded into every page,
> include the code that checks for enter key presses in input fields (use the
> $('input') jQuery selector to find all input fields on the page).
>
> Anthony
>
> On Monday, August 20, 2012 8:56:18 AM UTC-4, max wrote:
>>
>> hi anthony, i can include the change in the views/xyz.html , but how
>> cupld i set it globally for all the forms?
>>
>>
>> Am Montag, 13. August 2012 15:50:25 UTC+2 schrieb max:
>>>
>>> thank anthony.
>>>
>>> Am Montag, 13. August 2012 15:30:24 UTC+2 schrieb Anthony:
>>>>
>>>> On Monday, August 13, 2012 9:24:13 AM UTC-4, max wrote:
>>>>>
>>>>> I want to add the enter key instead of tab keys to the forms.
>>>>> is it possible to intergrate into web2py.
>>>>>
>>>>
>>>> Sure, but this has to be handled on the client side via Javascript.
>>>> Here's one solution: http://thinksimply.com/blog/jquery-enter-tab.
>>>>
>>>> Anthony
>>>>
>>>
--