[Pas2js] is it a bug fro pas2js?

Pedro Pablo Oviedo Vera verakuba13 at gmail.com
Fri Aug 16 17:27:57 CEST 2019


Hello, I have a problem:
I writing an event handler for invalid input from a html form element in
order to get a validation on real time:

FFormulario1            :=
TJSHTMLFormElement(document.getElementById('informacion1'));
FFormulario1.oninvalid  :=@Form2Validacion;

before I defined

function Form2Validacion(aEvent: TJSEventhandler): Boolean;
begin
  window.alert('Hay un campo con valores incorrectos!!!');
end;

knowing in web.pas say:
 TJSHTMLFormElement = class external name 'HTMLFormElement'
(TJSHTMLElement)

 TJSHTMLElement = class external name 'HTMLELement' (TJSElement)
 public
 oninvalid : TJSEventhandler;
 ...

but Lazarus in compile time shut me:
project1.lpr(262,28) Error: Incompatible type arg no. 1: Got
"TEventListenerEvent", expected "TJSEventHandler"

if I change to:
function Form2Validacion(aEvent: TEventListenerEvent): Boolean;

and then Lazarus compiles Ok!!!

but my browser claim to me with all justice:
TypeError: $mod.FFormulario1 is null!!!!

it will be an Error???

Thanks

pp

-- 

MSc. Ing. Pedro Pablo Oviedo Vera
Dirección Técnica y Desarrollo
Empresa de Proyectos e Ingeniería del
Ministerio de la Agricultura.ENPA.
Boyeros y Conill, Piso 10 Edif MINAG
Telef. 884 7197
SIP:23000116
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20190816/00d3e7f2/attachment.html>


More information about the Pas2js mailing list