Quantcast
Channel: Mendix Forum Questions
Viewing all articles
Browse latest Browse all 82448

Setting .focus on first input field

$
0
0

I sometimes run into situations where Mendix will not set autofocus to the first input field automatically. 

This happens mainly in full-page forms (pop-ups are usually fine) and may be due to styling.

 

Regardless; I figured I should be able to resolve it quite easily with a bit of javascript, so I threw a couple of code snippets at it through the browser console by way of test, but to no avail. 

$(".FirstFocus").focus();

or 

$(".FirstFocus:first").focus(); 

where FirstFocus is the class of the input field, both yield an output in the console:

[div#mxui_widget_TextInput_16.mx-name-textBox1.FirstFocus, prevObject: jQuery.fn.init(1), context: document, selector: ".FirstFocus:first"]

 and TextInput_16 is indeed the ID of the field I'm trying to set focus on. However, no focus is set.

 

My guess is I'm overlooking something dead obvious, but I rarely mess around much with the Mx frontend in this way.

Anyone with a push in the right direction? 


Viewing all articles
Browse latest Browse all 82448

Trending Articles