Joomla 2.5 Uncaught ReferenceError: Joomla is not defined - joomla

I just upgraded a joomla application from version 1.7 to 2.5... After the application initially worked I installed k2, upon uninstalling I now see a Uncaught ReferenceError: Joomla is not defined in my console.
it prevents the article editor from loading.
Uncaught ReferenceError: Joomla is not defined
it happens in this block of code I believe...
submitbutton = function(task) {
if (task == 'article.cancel' || document.formvalidator.isValid(document.id('item-form'))) {
if (tinyMCE.get("jform_articletext").isHidden()) {
tinyMCE.get("jform_articletext").show()};
tinyMCE.get("jform_articletext").save();
Joomla.submitform(task, document.getElementById('item-form'));
} else {
alert('Invalid form');
}
}
}
I won't even bother to beat around the bush... I'm stumped.

check your pluggin loading order and make sure all javascript needed is loaded before k2 this might help...

I was getting exactly the same thing, it turned out it was down to JCE Editor. I updated it to the latest version and this fixed this bug for me

Related

Debugging FPDF invalid call after upgrading laravel and PHP8

I have a web app that used FPDI to create pdf files, using laravel 5.7, setasign/fpdi-fpdf ^2.0 and PHP 7.4.
I recently upgraded to laravel 9 (also upgrading respective dependencies) and because the meta package was depcrecated, I now use "setasign/fpdf": "^1.8", "setasign/fpdi": "^2.0" as well as PHP 8.0.26
Now when trying to run my script I get the error "FPDF Error: Invalid Call" with the whole trace in the error handler, but I find this error message only semi informative.
Any ideas how I can debug this error?
Does FPDI have issues with PHP8? I didn't see any mention of that in the documentation.
thanks in advance!
From FPDF code, the error is shown when state == 1
fpdf.php#L1458
protected function _out($s)
{
// Add a line to the current page
if($this->state==2)
$this->pages[$this->page] .= $s."\n";
elseif($this->state==0)
$this->Error('No page has been added yet');
elseif($this->state==1)
$this->Error('Invalid call');
elseif($this->state==3)
$this->Error('The document is closed');
}
And state 1 is when the page ends
fpdf.php#L1128
protected function _endpage()
{
$this->state = 1;
}
Which happens when you close the document by calling output() (and when you switch to the next page but that automatically opens the next page).
So you might also have to read the new documentation of FPDF and adapt the code related to it.

Using an Android library that extends AppCompatDialog

So I'm trying to create a plugin that uses PrettyDialog (https://github.com/mjn1369/PrettyDialog) using the latest NativeScript seed.
However I've run into the following error when compiling:
Error: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
That happens using the following code, and calling show() (TypeScript):
export class PrettyAlert {
show() {
const alert = this.createAlert();
}
createAlert(width?: number) {
return new libs.mjn.prettydialog.PrettyDialog(app.android.context);
}
}
I've been looking into the error here (pure Android): You need to use a Theme.AppCompat theme (or descendant) with this activity
But none of the solutions have worked.
I figure it possible somehow, but I'm new a plugin building, and I'm sure there's some quirks I need to understand.
There are similar plugins - fancyalert / cfalert already if you are not very choosy about PrettyDialog.
NativeScript introduced support for AppCompatActivity from v5.x which seems just hit live. You should bypass this error if you upgrade to latest version.

How to prevent app from crashing on uncaughtErrorEvent

Is there a way to prevent the app from crashing when JS uncaught errors occur?
Already tried to wrap app.start(...) inside try/catch, but it sure doesn't work:)
There is indeed, you can register an uncaughtErrorEvent listener.
Refer to the official documentation - https://docs.nativescript.org/core-concepts/application-lifecycle#use-application-events
You can drop the following in your app.js before bootstrapping the application
var application = require("application");
application.on(application.uncaughtErrorEvent, function (args) {
if (args.android) {
// For Android applications, args.android is an NativeScriptError.
console.log("NativeScriptError: " + args.android);
} else if (args.ios) {
// For iOS applications, args.ios is NativeScriptError.
console.log("NativeScriptError: " + args.ios);
}
});
There's no way to prevent the app from crashing. You can catch the error in the uncaughtError application event but the app will crash afterwards regardless.
Attempting to navigate to an error page won't work.
According to the comments on this GitHub issue:
Ability to specify custom error pages on uncaughtErrors · Issue #1718 · NativeScript/NativeScript
there is a way to customize the error page shown, but only on Android. Apparently there isn't anything similar available for iOS.
This is an older question but there is a documented way to prevent this using Nativescript older than 4.2 (you should be on 6+ now)
Disable rethrowing of uncaught js exceptions to native
Basically, catch the JS errors but do not crash the native app.
Note the disclaimer there as well. The script will be unstable at this point. Yes, it did not crash, but wherever it dies did not continue, so you might be worse off for stability. Putting the app in a bad state or just quitting/recrashing might be safer.

Dropdown menu does not trigger in oneui 3.0.2 (in Firefox)

I use an dropDownButton from the extlib, which does not work when I changed to OneUI 3.0.2 (from 2.1, in which it works fine).
Happens in firefox (31.8), not in (a very old) IE. Firebug shows the following error in its console, when I click on on of the dropdown entries:
TypeError: _9.getAttribute is not a function ,
and it point to ...{return _6[_9.getAttribute("widgetId")];}... in the lib -extlib.dijit.OneUIv302Dialog&-extlib.dijit.OneUIv302Menu&#Eya.js
Is it a (known) bug?
my code:
<xe:dropDownButton
id="dropDownButton1">
<xe:this.treeNodes>
<xe:basicContainerNode
label="IAM">
<xe:this.children>
<xe:basicLeafNode
submitValue="approve1" label="approve selected">
</xe:basicLeafNode>
<xe:basicLeafNode
submitValue="reject0" label="reject selected">
</xe:basicLeafNode>
</xe:this.children>
</xe:basicContainerNode>
</xe:this.treeNodes>
<xp:eventHandler
event="onItemClick" submit="true"
refreshMode="complete">
<xe:this.action><![CDATA[#{javascript:submitIAMAction()}]]></xe:this.action>
</xp:eventHandler>
</xe:dropDownButton>
I have tested the Extension Library DropDownButton in conjunction with OneUI V3.0.2 without any troubles.
UPDATE "Output on server console":
I am working with the following environment:
Firefox 42
Domino Server 9.0.1FP4
Extension Library Version 9.0.1.v00_14_20150831-1301
It could be a problem with your Domino Server and/or Extension Library Version?
Try to do some updates on your environment.
It sounds like the same issue we had. In our case, I think the drop down entries could still work if you clicked on the actual text in the drop down option, clicking in the 'white space' would not work.
We found a solution thanks to Serdar Basegmez in the Defect list in ExtLib project on OpenNTF
http://extlib.openntf.org/main.nsf/project.xsp?r=project/XPages%20Extension%20Library/defects/0FFE08B1FC57FE6A86257D91004C156D
Give this a try:
put the following in a javascript library.
if(dojo.isMozilla) dojo.addOnLoad(function() {
dijit.registry.backupByNode=dijit.registry.byNode;
dijit.registry.byNode=function(node) {
if(node.getAttribute) {
return dijit.registry.backupByNode(node);
} else {
return dijit.registry.backupByNode(node.parentNode);
}
}
});
and then add your theme: (add add as a resource to a single page)
<resources>
<script src="/fixDropDownButton.js" clientSide="true"
type="text/javascript"></script>
</resources>

Kendo UI Grid - Error Happened

I am using nopCommerce 3.3. The admin uses the Kendo UI grid. On occassion, my pages fail to load. I see a dialog box that says error happened that will not disappear. I have found this code on my page:
function display_kendoui_grid_error(n) {
if(n.errors)
if(typeof n.errors=="string")
alert(n.errors);
else {
var t="The following errors have occurred:";
$.each(n.errors, function(n,i) {
i.errors && (t+="\n", t+=i.errors.join("\n"))
});
alert(t)
}
else
alert("Error happened")
}
I have noticed that CSS fails to load sometimes and possibly, some JS files fail to load. I am running IIS 8 using .NET 4.51. How do I found out the exact error message?
I ran a breakpoint on the code. n.errors is undefined. Is there another place to look for an error?
I upgraded my hosting plan to a dedicated server and it works. nopCommerce needs a lot of MB in the app pool to operate properly.
Set a breakpoint and see what n is, or print out the entire object by changing alert("Error happened") to something like:
alert("Error happened: " + JSON.stringify(n));
If these are errors that the user shouldn't see, then you should use console.error("the message"); instead. of an alert. Then you can see the messages as errors in the devtools console. You can also then just write whole objects to the console: console.error(n);

Resources