Database field validation using onSetText lazarus / 16-Databases ---------------------------------------------------------------------- joaoclobocar · 2021-05-13 18:52 I am moving to Lazarus, and currently facing a problem validating database fields. I have created OnSetText event for field validation and if not valid I raise an exception. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TModelLancamentoFinanceiro.SetTextValorDocumento(Sender: TField; const aText: string);var  Valor : Currency;begin  Valor := StrToCurr(aText);  if Valor <> 1 then  begin    raise Exception.Create(Format('o conteúdo %s não é válido para o campo %s', [aText, 'Valor']));  end  else    Sender.AsCurrency := Valor;end; I have entered "2" in the DBEdit field. If I type Enter key while in the DBEdit field, exception is raised and the current field value is shown back in the DBEdit. That is great. If I type Tab or change to the other field using mouse click, exception is raised, cursor move to the field, and the number shown in the DBEdit field is the invalid value "2". How to keep cursor in DBEdit field while its content is invalid? I have searched for a solution, tried some hacks, but having no success.