How to set focus on specific form control

2
Hello, How (if possible) can you set the focus on a specific form control? I have explored the Focus helper widget in the app store but it is limited and doesn't work with conditional visibility. Could this potentially be a nano flow action? Thanks Fredrik
asked
4 answers
4

Hello Fredrik,

As far as I'm aware there is no default tool in Mendix to allow you to manage focus, you would have to rely on a widget or js/jQuery.

Here's a small example with jQuery "$('.my-field').focus();" you can drop this in an HTML snippet widget as jQuery and it should do the trick.

Hope this helps 

answered
1

Hello Dragos,

Thanks for you reply. I understand that I can use js/jquery but how do I trigger it from a standard Mendix event - like conditional show, click on btn etc? We really try and stay away from custom widgets.

Thanks

Fredrik

answered
0

focus helper widget https://marketplace.mendix.com/link/component/107276

answered
0

If you would need to do this in a modern version of Mendix (9.0.5+), then you can use the Web Actions module. It will give you a set focus action specifically for use in nanoflows. That action can focus on any element that is able to hold focus by providing a selector.

You can also refer to the Web Actions documentation, although it is incorrect/incomplete at the time of writing (lists information about the Take Picture action).

answered