Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

strange behavior

 Post Reply Post Reply
Author
Zubov Andrey View Drop Down
New Member
New Member
Avatar

Joined: 24 Feb 2020
Posts: 10
Post Options Post Options   Quote Zubov Andrey Quote  Post ReplyReply Direct Link To This Post Topic: strange behavior
    Posted: 19 Mar 2020 at 12:41pm
I have html template
<ul>
<li><a id="Dashboard1" href="" class="waves-effect">Version 1</a>
</li>
<li><a id="Dashboard2" href="" class="waves-effect">Version 2</a>
</li>
</ul>

i drop on form one TWebHTMLAnchor and bind to element Dashboard1.
OnClick event simple Showmessage (ancDashboard1Click event)
On WebFormCreate event i write next code
document.getElementById('Dashboard2').addEventListener('click',@ancDashboard1Click);
try to bind event from first control to second
if i click on first control, all fine, message dialog
if i click on second link, message show to but application reload after click ok in message dialog.
why different behavior?

Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 9194
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 19 Mar 2020 at 2:40pm
The standard JavaScript click handler will call PreventDefault that will stop the default handling of navigating to a link (i.e. here the same page).
Just binding the event handler via addEventListener() bypasses this default behavior.
Back to Top
Zubov Andrey View Drop Down
New Member
New Member
Avatar

Joined: 24 Feb 2020
Posts: 10
Post Options Post Options   Quote Zubov Andrey Quote  Post ReplyReply Direct Link To This Post Posted: 20 Mar 2020 at 2:33pm
how i can disable this default behavior in binding mode?
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 9194
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 20 Mar 2020 at 2:38pm
There is currently not a setting for this. We'd need to introduce a property or another mechanism for this.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down