Help with onblur event JTAdvancedEdit

Post Reply
dbrazoli
Posts: 68
Joined: Thu Dec 19, 2013 6:33 pm

Help with onblur event JTAdvancedEdit

Post by dbrazoli » Fri May 17, 2019 10:47 am

Hello, Jon.
I need your help.
I use HTML5Builder.
I'm validating an input with JTAdvancedEdit, in the OnBlur event, making an ajax request, accessing the database and checking whether the code already exists or not. If it already exists, I'll display a message and focus on the input field, so the user can correct the input. But I'm entering a loop, with the message being repeated.
This is the block that I do the validation:
if (data.cnpj === '1') // already exists
{
alert ('CNPJ Already Registered');
$ ('# cecnpjconvenio'). focus ();

}
else // does not exist
{
$ ('# cerazsocconvenio'). focus ();

}
Could you help me with this code? I want the focus to be on the input field after the alert.
Thankful.

Post Reply