Frederick Posted May 6, 2025 Posted May 6, 2025 When using a TUniURLFrame in FireFox and calling the following code to trap an ESCAPE key press, urlFrame.JSInterface.JSCode(#1'.iframe.contentDocument.addEventListener("keydown", function(e){ajaxRequest('+ Self.WebForm.JSForm.JSName +', "keydown", ["key="+e.keyCode])});') FireFox throws the attached Ajax error. The error does not show in other browsers. How do I work around this problem? -- Frederick (UniGUI Complete - Professional Edition 1.95.0.1577) Quote
Sherzod Posted May 6, 2025 Posted May 6, 2025 5 minutes ago, Frederick said: urlFrame.JSInterface.JSCode(#1'.iframe.contentDocument.addEventListener("keydown", function(e){ajaxRequest('+ Self.WebForm.JSForm.JSName +', "keydown", ["key="+e.keyCode])});') Hello, Just to clarify — where exactly are you assigning this code? I’d recommend assigning this code inside the OnFrameLoaded event of TUniURLFrame. This way, you ensure the iframe content is fully accessible, and you won’t run into the null reference issue. Quote
Frederick Posted May 6, 2025 Author Posted May 6, 2025 This code is called in the OnFrameLoaded event. Quote
Administrators Farshad Mohajeri Posted May 6, 2025 Administrators Posted May 6, 2025 defer is a JS method to delay calling of code. Quote
Sherzod Posted May 6, 2025 Posted May 6, 2025 2 hours ago, Frederick said: Where do I set the defer setting? urlFrame.JSInterface.JSCode( 'Ext.defer(function(){' + '#1.iframe.contentDocument.addEventListener("keydown", function(e){' + 'ajaxRequest(' + Self.WebForm.JSForm.JSName + ', "keydown", ["key="+e.keyCode]);' + '});' + '}, 300);' ); Quote
irigsoft Posted May 6, 2025 Posted May 6, 2025 4 hours ago, Farshad Mohajeri said: defer is a JS method to delay calling of code. Is it possible to use defer on Form.OnCreate event ? I want to slow down execution of javascript until all element are created . Quote
Frederick Posted May 6, 2025 Author Posted May 6, 2025 5 hours ago, Sherzod said: urlFrame.JSInterface.JSCode( 'Ext.defer(function(){' + '#1.iframe.contentDocument.addEventListener("keydown", function(e){' + 'ajaxRequest(' + Self.WebForm.JSForm.JSName + ', "keydown", ["key="+e.keyCode]);' + '});' + '}, 300);' ); Thanks for the code but, I am now getting the following error in Firefox. If it is not Firefox, I get the second error. Quote
Sherzod Posted May 6, 2025 Posted May 6, 2025 urlFrame.JSInterface.JSCode( 'Ext.defer(function(){'#1'.iframe.contentDocument.addEventListener("keydown", function(e){' + 'ajaxRequest(' + Self.WebForm.JSForm.JSName + ', "keydown", ["key="+e.keyCode]);' + '});' + '}, 300);' ); Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.