View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
04839 | Bug reports | Conditions | public | 2010-12-30 11:11 | 2011-01-07 20:44 |
Reporter | mdekker | Assigned To | lemeur | ||
Priority | normal | Severity | partial_block | ||
Status | closed | Resolution | fixed | ||
Product Version | 1.90+ | ||||
Fixed in Version | 1.91RC1 | ||||
Summary | 04839: when more than one array dual scale question with drop downs is present conditions might fail | ||||
Description | Qanda introduces a special_checkconditions function for each and every duals scale drop down you use. This way the last inserted function wins and sometimes the condtions fail due to routing to noop_checkconditions instead of checkconditions. | ||||
Steps To Reproduce | check the attached survey, when you delete te last dual scale question is works fine but when you leave it in it doesn't (condition: first question, first scale set to first answer, the text question should pop up) | ||||
Tags | No tags attached. | ||||
Attached Files | dual_scale_dropdown.diff (3,269 bytes)
# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: C:\Documents and Settings\175780\My Documents\NetBeansProjects\LimeSurvey\limesurvey # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: qanda.php --- qanda.php Base (BASE) +++ qanda.php Locally Modified (Based On LOCAL) @@ -7420,19 +7420,7 @@ $separatorwidth=(100-$answerwidth)/10; $columnswidth=100-$answerwidth-($separatorwidth*2); - $answer = "<script type='text/javascript'>\n" - . "<!--\n" - . "\tfunction special_checkconditions(value, name, type, rank)\n" - . "{\n" - . "\tif (value == '') {\n" - . "if (rank == 0) { dualname = name.replace(/#0/g,\"#1\"); }\n" - . "else if (rank == 1) { dualname = name.replace(/#1/g,\"#0\"); }\n" - . "document.getElementsByName(dualname)[0].value=value;\n" - . "\t}\n" - . "$checkconditionFunction(value, name, type);\n" - . "}\n" - . " //-->\n" - . " </script>\n"; + $answer = ""; // Get Answers @@ -7578,7 +7566,7 @@ $answer .= "\t<td class=\"ddprefix\">$ddprefix</td>\n"; } $answer .= "\t<td >\n" - . "<select name=\"$myfname\" id=\"answer$myfname\" onchange=\"special_checkconditions(this.value, this.name, this.type,$dualgroup);\">\n"; + . "<select name=\"$myfname\" id=\"answer$myfname\" onchange=\"array_dual_dd_checkconditions(this.value, this.name, this.type,$dualgroup,$checkconditionFunction);\">\n"; if (!isset($_SESSION[$myfname]) || $_SESSION[$myfname] =='') { @@ -7632,7 +7620,7 @@ } // $answer .= "\t<td align='left' width='$columnswidth%'>\n" $answer .= "\t<td>\n" - . "<select name=\"$myfname1\" id=\"answer$myfname1\" onchange=\"special_checkconditions(this.value, this.name, this.type,$dualgroup1);\">\n"; + . "<select name=\"$myfname1\" id=\"answer$myfname1\" onchange=\"array_dual_dd_checkconditions(this.value, this.name, this.type,$dualgroup1,$checkconditionFunction);\">\n"; if (!isset($_SESSION[$myfname1]) || $_SESSION[$myfname1] =='') { Index: scripts/survey_runtime.js --- scripts/survey_runtime.js Base (BASE) +++ scripts/survey_runtime.js Locally Modified (Based On LOCAL) @@ -875,3 +875,16 @@ _collection.push(new multi_total(ids[ii])); } } + +//Special function for array dual scale in drop down layout to check conditions +function array_dual_dd_checkconditions(value, name, type, rank, condfunction) +{ + if (value == '') { + //If value is set to empty, reset both drop downs and check conditions + if (rank == 0) { dualname = name.replace(/#0/g,"#1"); } + else if (rank == 1) { dualname = name.replace(/#1/g,"#0"); } + document.getElementsByName(dualname)[0].value=value; + condfunction(value, dualname, type); + } + condfunction(value, name, type); +} | ||||
Bug heat | 4 | ||||
Complete LimeSurvey version number (& build) | 9643 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | |||||
Database type & version | dn | ||||
Server OS (if known) | dn | ||||
Webserver software & version (if known) | dn | ||||
PHP Version | dn | ||||
I had to do a quick fix in my running install. I just changed a line around 6500 in qanda.php in the section that defines the javascript special_checkcondition function to always use continue to the checkconditions function |
|
Noticed another strange thing: when both dropdowns are set to be empty, the conditions only update for one of the drop downs. The java{SGQID} is only updated once instead of twice. |
|
Added a fix for the dropdown layout, didn't check the radio button layout. Please review and commit if you think it is the right way to solve this. |
|
Hi mdekker, Many thanks for your work on this one. Lemme check your fix. |
|
Your fix is ok. Comitted to version 9695 Many thx |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2010-12-30 11:11 | mdekker | New Issue | |
2010-12-30 11:11 | mdekker | Status | new => assigned |
2010-12-30 11:11 | mdekker | Assigned To | => lemeur |
2010-12-30 11:11 | mdekker | File Added: limesurvey_survey_78491.lss | |
2010-12-30 11:13 | mdekker | Note Added: 13834 | |
2010-12-30 11:26 | mdekker | Note Added: 13835 | |
2011-01-03 12:07 | mdekker | File Added: dual_scale_dropdown.diff | |
2011-01-03 12:08 | mdekker | Note Added: 13841 | |
2011-01-04 20:43 | lemeur | Note Added: 13845 | |
2011-01-04 20:43 | lemeur | Status | assigned => confirmed |
2011-01-04 20:57 | lemeur | Note Added: 13846 | |
2011-01-04 20:57 | lemeur | Status | confirmed => resolved |
2011-01-04 20:57 | lemeur | Fixed in Version | => 1.91RC1 |
2011-01-04 20:57 | lemeur | Resolution | open => fixed |
2011-01-07 20:44 | c_schmitz | Status | resolved => closed |