?
avatar thekrotek
thekrotek
11 Sep 2015

Since 3.4.4 Joomla started to produce a "too much recursion" JavaScript error with core.js file in ALL my components, which use this code:

Joomla.submitbutton = function(task)
{
if (task == 'sometask') {
if (confirm("Do you really want to do this?")) {
submitbutton(task);
}
} else {
submitbutton(task);
}
}

This code worked perfectly for YEARS, but now it's broken. It actually was taken from some standard Joomla component lately.

Error pops, when you click a button on toolbar (Edit, Publish, Unpublish etc). All buttons are created using standard Joomla JToolBarHelper class.

Looks like an issue to me.

avatar thekrotek thekrotek - open - 11 Sep 2015
avatar Fedik
Fedik - comment - 11 Sep 2015

submitbutton() is deprecated and internally use Joomla.submitbutton .. so you got recursion,
Correct code is:

Joomla.submitbutton = function(task) {
 // some of your code 
 ...
 ...
 Joomla.submitform(task); // actually submit the form
}
avatar thekrotek
thekrotek - comment - 11 Sep 2015

Nice... So I should update all my components due to this doubtful "deprecation". Very smart.

Will Joomla.submitform(task) work for older versions of Joomla or should I add another version check just for this?

avatar Fedik
Fedik - comment - 11 Sep 2015

Sorry for disappoint you, but submitbutton() deprecated since Joomla 2.5 and Joomla.submitbutton , Joomla.submitform added since then .. or maybe even in Joomla 1.6 ..
Also your original code is incorrect ...

so I wonder why you wonder :smile:

avatar thekrotek
thekrotek - comment - 11 Sep 2015

I wonder, because it worked perfectly upto 3.4.3.

avatar infograf768
infograf768 - comment - 11 Sep 2015

Joomla.submitbutton and Joomla.submitform are indeed present in 1.6.0 ;)

avatar Fedik
Fedik - comment - 11 Sep 2015

there was some changes in core.js in 3.4.x,
I guess that changes have uncovered your bug

I know it is a bit confused, because there no explanation,
but correct usage is to call submitform() inside submitbutton() .. but do not call submitbutton() inside submitbutton() ...
no matter it is Joomla.submitbutton() (Joomla.submitform()) or old submitbutton() (submitform())

avatar Kubik-Rubik
Kubik-Rubik - comment - 11 Sep 2015

Thank you @Fedik for the explanation. I will close this issue since the code was used incorrectly even before the changes in the core.js. @thekrotek Please update the code in your extensions!

avatar Kubik-Rubik Kubik-Rubik - change - 11 Sep 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-09-11 10:00:53
Closed_By Kubik-Rubik
avatar Kubik-Rubik Kubik-Rubik - close - 11 Sep 2015

Add a Comment

Login with GitHub to post a comment