I need set focus from one input, on "Onblur" event to another input, i've tried create a javascrip Function on a form:

function setFocusToTextBox(x){

and in the input, onblur event, i put like this:

"setFocusToTextBox(" + AddDebito.Id + ")"

But all this didn't work, and i dont have a clue that i'm supposed to do now

Debug! :) Joking aside, check whether the setFocusToTextBox is actually called by adding a Console.Log in there (it would be wise to also include the value of "x") and checking the console via your browser's devtools. Also check for any JavaScript errors in the console.


Thanks, but i discovered a way to do this. In the form, on javascrip, i put this

function SetFocus(widgetId)
    var widget = document.getElementById(widgetId);
    if (widget == null)
        try {
            window.OsHandleException(new Error("Invalid use of RichWidgets\\Input_SetFocus: Please specify the runtime Id property of an Input or Input Password widget."), outsystems.osErrorCodes.SystemJavascriptError, 'Input_SetFocus');
        } catch(e) {}

    widget = null;

And on "Onblur" event, i set the widget id that i want to go. I copied this code from input_setfocus on Richwidgets and changed some little things :)


Hi Deivd,

This issue could be related to the place you are defining your javascript function.  This code should be placed on the javascript property from the Screen where you put your form. Inside the onblur event you can use it directly.

Try to use de chrome dev tools to open console and try to test this call directly there. You will have more specific error message there to help you to fix it. When you are using custom javascript directly on your code, the error messages are not so clear at most of the time.

Best Regards

Fabio Fantato