An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20220524/12d88229/attachment.htm>
Mailing lists / lazarus / 2022-05
Pas2Js and component binding
3 messages · 2 people ·
- MMarcello 2
- MMichael Van Canneyt 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Marcello wrote 21 lines
hi all
I've some problems in binding html elements.
This is the thread I open in forum, attached you can found the my source project.
https://forum.lazarus.freepascal.org/index.php/topic,59432.0.html
The strange is: inside doRun I call BindElements and seems it works.
Inside the OnClick event of a button, the bind is not valid anymore and I need to bind again before using components.
1. procedure?TMyApplication.doLoginClick(aEvent:?TJSEvent);
2. begin
3. ??Writeln('doLoginClick');
4. ??// BindElements; ? // <- uncomment and all works!
5. ??writeln('edtEmail.Value = ',?edtEmail.value);?? ?// <- this give the error
6. ? DoServerLogin(edtEmail.Value,edtPassword.Value);
7. end;
So, why the bind is not persistent and I need to bind again before use a component in OnClick event?
Any idea?
Normally the bind should be persistent.
I use the described technique since several years meanwhile.
Please check if your program code contains an Application.Free after the Application.Run. If it does, remove it.
Earlier versions of Lazarus generated this statement erroneously when using the 'new web application' wizard.
I've been bitten by that problem myself several times.
Michael.
Il 24/05/22 09:30, Michael Van Canneyt ha scritto:
Show quoted text 15 lines
So, why the bind is not persistent and I need to bind again before use
a component in OnClick event?
Normally the bind should be persistent. I use the described technique
since several years meanwhile.
Please check if your program code contains an Application.Free after
the Application.Run.
If it does, remove it.
Earlier versions of Lazarus generated this statement erroneously when
using
the 'new web application' wizard.
That?s the problem.
Application.Free removed, now works perfectly!
I'll report this solution in the forum.
thanks
nomorelogic
