- Home
- Forum
- JavaScript - EJ 2
- Alternative for onfocusout?
Alternative for onfocusout?
I'm using onfocusout to invoke a function when I open an external web-url from inside the Rich Text Editor. It works as it should, however, onfocusout is also invoked by the 'sub-popups' of the standard popup, which means that a script that the function invokes is running a lot more than I want it to.
Question:
Is there an event that I could use instead of onfocusout, to trigger my script, when a url is opened?
or
Is there a way of preventing onfocusout from being triggered by the 'sub-popups'?
Many thanks for any help,
Grant
( What I mean by 'sub-popups': )
Just adding to the question, because I've realised, that all I need is to be able to trigger my function, when the 'Open Link' button is clicked in the URL-Pop-up. Is there a way to do this??
var defaultRTE = new ej.richtexteditor.RichTextEditor({ toolbarClick: toolbarClick, }); defaultRTE.appendTo('#defaultRTE'); function toolbarClick(args) { if (args.item.subCommand == 'OpenLink') { // here you can handle your code. } } |
Hi Vinitha,
I hope you're well.
Thank you for the code which works well. However, I can't find out how to make the button also perform its intended task, i.e., open the URL/Link. (Sorry 😬... I'm not a programmer. 🙁)
This is what I have ... how do I make it also open the link?
function toolbarClick(args) {
if (args.item.subCommand == 'OpenLink') {
FileMaker.PerformScriptWithOption ( 'Get-Source-JSFunction', "JSFn_fromCode", '5' )
()}}
Hi Grant,
cancel event argument in the toolbarClick event. function toolbarClick(args) { if (args.item.subCommand == 'OpenLink') { alert('function worked'); // here you can handle your code. } } |
Sample: https://stackblitz.com/edit/7uncgxmt-dmnwrw19?file=index.js
Hi Vinitha,
thank you for the reply.
I'm not sure why it is being cancelled when run with my function... perhaps it's loosing focus?? Can you suggest anything that could work around the problem?
Best wishes,
Grant
(I've attached a video-grab of the problem)
Attachment: GSymonvideoGrabSyncfusionopenLink_9d59912f.zip
Hi Grant,
We attempted to reproduce the reported issue by returning a function within the toolbarClick event to simulate a scenario similar to yours. However, we were unable to observe the issue you described. Please refer to the sample provided below for reference.
toolbarClick event?Hi Vinitha,
thank you for your reply.
I'm sorry to have wasted your time!! 🫣 I found the problem was an extra "( )" in the Filemaker function. Sigh... I don't have html/js writing software so it's just down to visual checking and trial-and-error. I'm really sorry I missed it. I hope you didn't waste too much of your time.
Anyway ... the good news is that your toolbarClick fix works perfectly!! 😊😎 So thank you very much for providing it.
Best wishes,
Grant
Grant,
We are glad to assist you.
- 8 Replies
- 2 Participants
-
GS Grant Symon
- Apr 30, 2026 12:47 PM UTC
- May 14, 2026 11:19 AM UTC