Possible bug in

17 views
Skip to first unread message

Joeri Theelen

unread,
Jul 26, 2010, 4:17:10 AM7/26/10
to arkdev
I believe I found a nasty bug in file "ark/js/sf_submit.js". Lines
239-248:

//we need to correctly set the qtypes
if (pair.indexOf('_qtype') > 0 ) {
split_qtype = pair.split("_");
if (array_key_exists(split_qtype[0],url_array)) {
url_array[pair] = 'add';
add_update_db = 1;
} else {
url_array[pair] = 'skp';
}
};

You should not use the split("_") method because, when the first part
of the qtype-string contains an underscore, the "key" taken from the
pair string is wrong and won't be found in the list of keys of the
array. In my case: fnd_material_qtype was split into "fnd" +
"material_qtype" and not "fnd_material" + "qtype". Because of this,
submitting a dropdown list is never recorded.

Change it into something like this:

//we need to correctly set the qtypes
var index_of_qtype = pair.indexOf('_qtype');
if (index_of_qtype > 0 ) {
var first_part = pair.substring(0, index_of_qtype);
if (array_key_exists(first_part,url_array)) {
url_array[pair] = 'add';
add_update_db = 1;
} else {
url_array[pair] = 'skp';
}
};
Reply all
Reply to author
Forward
0 new messages