Error in qcubed.js ?

Login or register to post comments
8 replies [Last post]
Offline
Joined: 03/27/2010

Hi everyone,
while I was trying to use an EditPanel draft, I noticed that the save button didn't work. It was because I had a javascript error "children is not a function" at line 191 of qcubed.js
I tried changing that line from

this.children(':selected').each (function (i) {

to

$j(this).children(':selected').each (function (i) {

And now it works.
What do you think?

Thanks
Luca

Offline
Joined: 03/27/2010

I found a similar problem at line 86.

if ($j('#' + strForm + ' :input[name="' + this.name + '"]').val() == undefined) {
   var real = $j("#" + this.name);
   var cloned = real.clone(true);
   real.hide();
   cloned.insertAfter(real);
   real.appendTo("#" + strForm);
}

This block is executed in the validation of an EditPanel if none of the elements of a multiple-select is selected. In this case I got the following error:
uncaught exception: Syntax error, unrecognized expression: ]

Changing from
var real = $j("#" + this.name);
to
var real = $j("#" + $j(this).name);

Makes it work

alex94040's picture
Offline
Joined: 11/06/2008

Makes sense, thanks for your feedback! Can you be so kind and create a patch, please?

alex94040's picture
Offline
Joined: 11/06/2008
Offline
Joined: 03/27/2010

Patch created.
Sorry to bother you: I don't know how to post it in trac. I guess I should login in the system but I have no credentials...

Offline
Joined: 03/27/2010

I found another problem - line 180 of qcubed.js:

if ($j(this).checked) {

should be:

if ($j(this).is(':checked')) {

or

if ($j(this).attr('checked')) {

It should work for both radio and checkbox.

I can make a single patch for these problems, but I still don't know how to login in the trac system...

Offline
Joined: 03/31/2008

Trac uses the same username/password as the forums. :) Hopefully in the future we can avoid the duplicate login requirement.

And thank you very much for these fixes! :)

Offline
Joined: 03/27/2010

Line 191 isn't enough. The post information is still wrong. There is one more line to modify:
line 192

strPostData += "&" + $j(this).attr("name") + "=";

should be changed to:

strPostData += "&" + $j(this).parent().attr("name") + "=";

Offline
Joined: 03/27/2010

Ok, patch posted!
I won't waste your time telling you what I was doing wrong :-)