Error in qcubed.js ?
Fri, 04/09/2010 - 15:33
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

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
Makes sense, thanks for your feedback! Can you be so kind and create a patch, please?
Ticket created: http://trac.qcu.be/projects/qcubed/ticket/542
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...
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...
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! :)
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") + "=";Ok, patch posted!
I won't waste your time telling you what I was doing wrong :-)