Skip to main content
Question

How to keep focus on a field with the modern UI?

  • January 31, 2026
  • 0 replies
  • 11 views

Forum|alt.badge.img

Hello Everyone,

In Classic UI I have a form with a field where the user inputs a barcode and the backend adds a new line in a grid with the proper record.

The focus returns to the input field after adding the line for the user to capture the next line.

However I haven’t found a way to get this done with the modern UI.

It used to be a very simple JS code in the aspx:

<script>
function FormView_Load(): void {

    px_callback.addHandler(setFocusOnCB);

}

let setFocus: boolean = false;

function setFocusOnCB(context?: any, error?: any): void {

    if (setFocus === true) {

        setFocus = false;

        const cb = px_alls["edCBField"];

        cb.focus();

    }

}
</script>

 Has anyone figure this out ?