JavaScript error: Cannot read property "focus" of null
Application Type
Reactive

Hi buddies,


I hope you are well.


I have an issue when applying this Javascript to focus an input.

This error appears to me.


I have this JavaScript and when the code runs this error appears to me.


Can you help me, please?


Thanks in advance,

FC

Solution

Please try to put that javascript logic or the "SetFocus" action in the "OnReady" event.


Regards,

João Varela

Solution

Hello Fábio,

Hope you’re doing well.


Can you please share the OML so I can give you a more valid solution? Also, where are you applying that javascript?


Alternatively, to apply focus you can use the OutSystems function “SetFocus” that is available in the dependencies -> “OutSystemUI” -> “Accessibility” -> “SetFocus”.


Let me know if this is the solution that you are looking for.


Regards,

João Varela



Hi João,


Sorry, but I can't because I'm working on a virtual machine, but if you need some prints I can share them with you. No problem!


I'm applying the Javascript on my "OnInitialize".


Thanks.

FC

Solution

Please try to put that javascript logic or the "SetFocus" action in the "OnReady" event.


Regards,

João Varela

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.