Skip to main content
Question

How/when to set focus on a web-form with ux- components.

  • Jul 23, 2026 2:22 PM UTC
  • 3 replies
  • 67 views

Iain Sharp
Forum|alt.badge.img+5

I have written a simple ‘login’ form as a DSP. 
When run in chrome focus is placed in the ‘username’ field. 
When run using $widgetoperation("LoadURL",v_url) in a uniface form, with the only visible field being the html widget, (mapped top, bottom, left. right) no field has focus, and tab is required to get focus on the username field. 

I have tried setting $prompt to the html field just before the edit command. And using the .focus() property of the name field in a webactivate of javascript at the very end of the exec trigger in the dsp. 

Putting an alert in the javascript indicates the focus is set before the ‘placeholder’ values are removed from the data (and the labels etc assigned) so I think that is too early. 
Is there a trigger fired when uniface has done all it’s work on populating the fields and labels using ux- or can someone tell me why the behaviour is likely to be different between cefrender and chrome for gettinf the focus in the first place? 

Regards, 


Iain

 

3 replies

Iain Sharp
Forum|alt.badge.img+5
  • Author
  • Inspiring
  • Jul 23, 2026 3:20 PM UTC

And then, because I write on here, it suddenly starts working. 

Might be because I took out the alert(“Here”) messaage. 

 


OsmanShariff
Forum|alt.badge.img+3
  • Participating Frequently
  • Jul 24, 2026 12:14 PM UTC

It may be because any changes to JavaScript requires a clearing of the browser cache.


Iain Sharp
Forum|alt.badge.img+5
  • Author
  • Inspiring
  • Jul 24, 2026 2:36 PM UTC

Well, as it happens, since I was replacing the login page on our client/server application, I was restarting the application each time, so there was no cache.