Posts: 21
Threads: 7
Joined: Jul 2018
Reputation:
0
Location: Italy
How can be done a data validation for the user input in a db aware control ?
Can be used one of the control events ?
Must be used Javascript ?
Thank you.
Posts: 21
Threads: 7
Joined: Jul 2018
Reputation:
0
Location: Italy
08-25-2018, 04:41 PM
(This post was last modified: 08-25-2018, 05:23 PM by geremiah.)
I'm using some validation code in the onChange event, but if the user input is not validated how can i give back to focus to the control ? Using the controlname.focus() isn't working.
Posts: 288
Threads: 0
Joined: Mar 2018
Reputation:
29
Location: Franca-São Paulo-Brasil
I don't understand very well are you trying to do. In asyncchange the component don't lose focus. In delphi side component.SetFocus; works. in JavaScript $("component").focus(); works too.
Posts: 288
Threads: 0
Joined: Mar 2018
Reputation:
29
Location: Franca-São Paulo-Brasil
Geremiah, i have not seen your code, so I'm working with assumptions and i have an idea for you. In your ScriptEvents when it isn't valid put this code:
if (isn't valid)
{
this.focus(); /* or IWCOMPONENTIWCL.focus(); */
return false;
}else{
return true;
}
Posts: 288
Threads: 0
Joined: Mar 2018
Reputation:
29
Location: Franca-São Paulo-Brasil
Geremiah, move you code to onBlur event and change this.focus(); to IWCOMPONENTIWCL.focus; ( your component name in UpperCASE plus IWCL ).
Posts: 21
Threads: 7
Joined: Jul 2018
Reputation:
0
Location: Italy
Thank you for your suggestion.
I've tested with Internet Explorer and Microsoft Edge and it runs well, on Firefox quantum still not working, now i'm going to test on Chrome and Safari.
Posts: 21
Threads: 7
Joined: Jul 2018
Reputation:
0
Location: Italy
08-26-2018, 07:58 PM
(This post was last modified: 08-27-2018, 07:04 AM by geremiah.)
I've finished the tests on all the browsers i have.
I've made a little modify to the focus code as follow:
setTimeout(function(){TIWDBADVEDIT1IWCL.focus();}, 1);
In this way all is working fine on all the browsers.
Thank you very much Jose, without your help I would never have solved the problem.