?
avatar chivitli
chivitli
11 Mar 2014

Go to Menus -> Menu manager -> Add New Menu. Try to save. Error console shows "TypeError: a is undefined". Maybe it's related to GSoC pulls?

(this is a copy of http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33443&start=0)

avatar chivitli chivitli - open - 11 Mar 2014
avatar javigomez
javigomez - comment - 11 Mar 2014

Thanks for reporting @chivitli

Do you mean in version 3.2.3. isn't it?

I have just tested with a 3.2.3 and I can't reproduce. Can you share more details about what you did in the New Menu Screen to get this error?

avatar javigomez
javigomez - comment - 11 Mar 2014

I have recorded a video adding the menu: http://www.youtube.com/watch?v=67USvsq7aZY

However I noticed that the information is not populated in case of failure when saving form.

avatar chivitli
chivitli - comment - 11 Mar 2014

Hi Javier,

No, 3.3-dev as noted in the report, that's why I mentioned latest GSoC pull requests which removed mootools dependancy, perhaps it's something to do with them?

avatar mbabker
mbabker - comment - 11 Mar 2014

I noticed something weird with the JS too on one of my extensions, none of
the toolbar buttons worked.

On Tuesday, March 11, 2014, Marko D notifications@github.com wrote:

Hi Javier,

No, 3.3-dev as noted in the report, that's why I mentioned latest GSoC
pull requests which removed mootools dependancy, perhaps it's something to
do with them?

Reply to this email directly or view it on GitHub#3278 (comment)
.

avatar Bakual
Bakual - comment - 11 Mar 2014

Can you check if core.js is loaded? I think that one is used for the buttons. Till now this was loaded together with Mootools, and if we now have views where Mootools isn't loaded anymore, then core.js would be missing as well.
That's why I proposed to introduce JHtmlBehavior::core() to load core.js and we would have to add this to all views who need it.

avatar chivitli
chivitli - comment - 11 Mar 2014

It's loaded. Here is the list of loaded js:

<script type="text/javascript" src="/joomla3.3/media/jui/js/jquery.min.js">
<script type="text/javascript" src="/joomla3.3/media/jui/js/jquery-noconflict.js">
<script type="text/javascript" src="/joomla3.3/media/jui/js/jquery-migrate.min.js">
<script type="text/javascript" src="/joomla3.3/media/system/js/tabs-state.js">
<script type="text/javascript" src="/joomla3.3/media/system/js/mootools-core.js">
<script type="text/javascript" src="/joomla3.3/media/system/js/core.js">
<script type="text/javascript" src="/joomla3.3/media/system/js/punycode.js">
<script type="text/javascript" src="/joomla3.3/media/system/js/validate.js">
<script type="text/javascript" src="/joomla3.3/media/jui/js/chosen.jquery.min.js">
<script type="text/javascript" src="/joomla3.3/media/jui/js/bootstrap.min.js">
<script type="text/javascript" src="/joomla3.3/media/system/js/html5fallback.js">
<script type="text/javascript" src="templates/isis/js/template.js?f87a670b452f75b4c21c8ebe98fa697c">

And two inline, one for activating chosen and tooltip, the other

(function() {
var strings = {"JLIB_FORM_FIELD_INVALID":"Invalid field:&#160"};
if (typeof Joomla == 'undefined') {
Joomla = {};
Joomla.JText = strings;
}
else {
Joomla.JText.load(strings);
}
})();

avatar Bakual
Bakual - comment - 11 Mar 2014

hmm. I tried to reproduce it but it worked for me with my test server.

avatar chivitli
chivitli - comment - 11 Mar 2014

Hmm, I can try to install nightly again. I tried in two browsers before submitting the bug though, both cache free.

avatar chivitli
chivitli - comment - 11 Mar 2014

Still present, I tried all main browsers.

avatar Bakual
Bakual - comment - 11 Mar 2014

Ah sorry, got it now. It's creating a menu, not a menu item like I tried.

avatar Bakual
Bakual - comment - 11 Mar 2014

Looks like this line is wrong: https://github.com/joomla/joomla-cms/blob/3.3-dev/media/system/js/validate-uncompressed.js#L101
$(form).data('inputfields') returns undefined when I echo it into console. Thus the $.each() fails afterwards.
Any JS people around? :smile:
@AshanFernando can you have a look?

avatar chivitli
chivitli - comment - 11 Mar 2014

I was about to comment the same, I just came to it :)

avatar Hackwar
Hackwar - comment - 11 Mar 2014

The $ is local to that function and thus will most likely not work in the console. As far as I can see, the script currently is a mess of mootools and jquery code.

avatar Bakual
Bakual - comment - 12 Mar 2014

The $ is local to that function and thus will most likely not work in the console.

That's not the issue. I used console() in the source code which always works.

avatar AshanFernando
AshanFernando - comment - 12 Mar 2014

@Bakual If you are trying in the console use jQuery(form).data('inputfields') currently $ is dedicated to MooTools in Joomla and when using with jQuery.noConflict

avatar Bakual
Bakual - comment - 12 Mar 2014

console.log(jQuery(form).data('inputfields')); gives undefined. Which I believe is the basic issue.
The next error I get is "Cannot read property 'length' of undefined" from jQuery.each
I'm not familiar with JS nor jQuery to know what it's supposed to do here.

avatar mbabker
mbabker - comment - 12 Mar 2014

Anyone have any suggestions on a solution here?

avatar chivitli
chivitli - comment - 12 Mar 2014

Yes, but I am not sure if it's a real solution. The problem comes from

// Attach to forms with class 'form-validate'
$('form.form-validate').each(function() {
attachToForm(this);
}, this);

When adding menus, there is no form with that class, instead it has form-horizontal class. If I would add that class as well to edit.php in administrator\components\com_menus\views\menu\tmpl, then it would work fine.

I don't know if the solution is to call attachToForm on any form regardless of the class (maybe that's why your toolbars broke?), or to edit the layout. If before there was no dependancy on the form class, I guess it should be removed and the call should be $('form').each(function() {. But if someone knows better how this worked, they should speak up, I am guessing

avatar mbabker
mbabker - comment - 12 Mar 2014

Well, the validator is supposed to be opt-in from my understanding. So, having the check for form-validate isn't a bad thing, but inputfields needs to be set on the form object no matter what. It's a B/C break in ways to now require the form-validate class, so this needs to be resolved.

avatar Bakual
Bakual - comment - 13 Mar 2014

Or the JS needs to check if inputfields is defined before it tries to process further. That would probably work as well.

avatar Hackwar
Hackwar - comment - 14 Mar 2014

#3303 should fix this one. However, I'm not exactly sure about this... Please test. :smile:

avatar chivitli
chivitli - comment - 14 Mar 2014

test ok here!

avatar Hackwar
Hackwar - comment - 14 Mar 2014

please comment in the PR. If that PR does not solve the issue, we might open a new PR and then don't have to guess which "test ok" is for which PR.

avatar chivitli
chivitli - comment - 14 Mar 2014

Ok, did

avatar zero-24 zero-24 - close - 28 Mar 2014
avatar infograf768
infograf768 - comment - 28 Mar 2014

PR is now committed

avatar infograf768 infograf768 - change - 28 Mar 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-03-28 15:38:49
avatar infograf768 infograf768 - close - 28 Mar 2014
avatar zero-24 zero-24 - change - 7 Jul 2015
Labels Added: ?
Removed: ? ?

Add a Comment

Login with GitHub to post a comment