This is the JavaScript we're using to set the focus on an input field when loading a form:
setTimeout(function()
{
$('.activetextbox input').focus();
},500);
As you might see, our textbox has the .activetextbox class
@Paul: Your snippet shift focus to the top of the page (if I scroll down first, and then fire the command from the browser console), so it's having an effect. Still no focus on the field though.
I'm starting to get the impression that something on the page is interfering, but I'm not yet sure what. Will run further tests.
What I've got so far:
When the page is opened and the input field is still empty, focus is set to the first input field (by Mendix, even without script).
When the page is opened and the input field has contents, no focus is set. If I try to set focus to the first field using javascript, it does move the page back up to put the field in view (if needed), but nothing more.
It doesn't seem logical that the input field having contents should prevent .focus() from working (can't find any info to that effect), but so far it seems the only difference.
Hello,
I think it would be a great improvement to automatically set the initial focus to the component having the tab index set to 0.
Regards,
Alexandre