View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
05943 | Bug reports | Survey taking | public | 2012-03-22 11:58 | 2012-06-07 11:02 |
Reporter | ResearchOnBlogs | Assigned To | TMSWhite | ||
Priority | normal | Severity | minor | ||
Status | closed | Resolution | fixed | ||
Product Version | 1.92+ | ||||
Fixed in Version | 1.92+ | ||||
Summary | 05943: exclusive option in multiple choice hide all other answer options | ||||
Description | If you use the exclusive option in a multiple choice question type, and you choose this answer, all other options where hidden. If you re-check the box, all option are viewable again. | ||||
Tags | No tags attached. | ||||
Attached Files | diff5943_120419.diff (10,810 bytes)
diff --git a/classes/expressions/LimeExpressionManager.php b/classes/expressions/LimeExpressionManager.php index b049794..cc8ec14 100644 --- a/classes/expressions/LimeExpressionManager.php +++ b/classes/expressions/LimeExpressionManager.php @@ -3227,6 +3227,12 @@ if (!isset($this->subQrelInfo[$questionNum])) { $this->subQrelInfo[$questionNum] = array(); } + // Set the hide mode according to the reason why it's hidden. TODO add attribute in each question with sub question. + if(strpos($type,'exclude_all_others')!==false){ + $hideMode='input'; + }else{ + $hideMode=''; + } $this->subQrelInfo[$questionNum][$rowdivid] = array( 'qid' => $questionNum, 'eqn' => $eqn, @@ -3240,6 +3246,7 @@ 'qtype'=>$qtype, 'sgqa'=>$sgqa, 'hasErrors'=>$hasErrors, + 'hideMode'=>$hideMode, ); } return $result; @@ -5508,11 +5515,11 @@ $rowdividList[$sq['rowdivid']] = $sq['result']; // $relParts[] = " // Apply " . $sq['type'] . ": " . $sq['eqn'] ."\n"; $relParts[] = " if ( " . $sq['relevancejs'] . " ) {\n"; - $relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').show();\n"; + $relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').lsemShow('{$sq['hideMode']}');\n"; $relParts[] = " if ($('#relevance" . $sq['rowdivid'] . "').val()!='1') { relChange" . $arg['qid'] . "=true; }\n"; $relParts[] = " $('#relevance" . $sq['rowdivid'] . "').val('1');\n"; $relParts[] = " }\n else {\n"; - $relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').hide();\n"; + $relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').lsemHide('{$sq['hideMode']}');\n"; $relParts[] = " if ($('#relevance" . $sq['rowdivid'] . "').val()=='1') { relChange" . $arg['qid'] . "=true; }\n"; $relParts[] = " $('#relevance" . $sq['rowdivid'] . "').val('');\n"; switch ($sq['qtype']) @@ -5687,14 +5694,14 @@ if ($arg['hidden']) { $relParts[] = " // This question should always be hidden\n"; - $relParts[] = " $('#question" . $arg['qid'] . "').hide();\n"; + $relParts[] = " $('#question" . $arg['qid'] . "').lsemHide();\n"; $relParts[] = " $('#display" . $arg['qid'] . "').val('');\n"; } else { if (!($relevance == '' || $relevance == '1')) { // In such cases, PHP will make the question visible by default. By not forcing a re-show(), template.js can hide questions with impunity - $relParts[] = " $('#question" . $arg['qid'] . "').show();\n"; + $relParts[] = " $('#question" . $arg['qid'] . "').lsemShow();\n"; if ($arg['type'] == 'S') { $relParts[] = " if($('#question" . $arg['qid'] . " div[id^=\"gmap_canvas\"]').length > 0)\n"; @@ -5722,7 +5729,7 @@ if (!($relevance == '' || $relevance == '1')) { $relParts[] = "else {\n"; - $relParts[] = " $('#question" . $arg['qid'] . "').hide();\n"; + $relParts[] = " $('#question" . $arg['qid'] . "').lsemHide();\n"; $relParts[] = " if ($('#relevance" . $arg['qid'] . "').val()=='1') { relChange" . $arg['qid'] . "=true; }\n"; // only propagate changes if changing from relevant to irrelevant $relParts[] = " $('#relevance" . $arg['qid'] . "').val('0');\n"; $relParts[] = "}\n"; diff --git a/config.php b/config.php index bfcc6be..82b10b1 100644 --- a/config.php +++ b/config.php @@ -10,7 +10,7 @@ * free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id$ + * $Id: config.php 9651 2010-12-16 14:25:20Z c_schmitz $ */ /* IMPORTANT NOTICE @@ -24,9 +24,9 @@ // Basic Setup -$databasetype = 'mysql'; // ADOdb database driver - valid values are mysql, mysqli, odbc_mssql, mssql_n, odbtp or postgres +$databasetype = 'mysqli'; // ADOdb database driver - valid values are mysql, mysqli, odbc_mssql, mssql_n, odbtp or postgres // mysql: Recommended driver for mysql - // mysqli: Slightly faster driver for mysql - not on all server systems available + // mysqli: Slightly faster driver for mysql - not on all server systems available // odbc_mssql: MSSQL driver using ODBC with MS SQL Server // mssqlnative: Native SQL Server driver for SQL Server 2005+ // mssql_n: Experimental driver for MS SQL Server which handles UTF-8 charsets @@ -34,28 +34,34 @@ $databasetype = 'mysql'; // ADOdb database driver - valid values a // postgres: Standard postgres driver $databaselocation = 'localhost'; // Network location of your Database - for odbc_mssql or mssqlnative use the mssql servername, not localhost or IP -$databasename = 'limesurvey'; // The name of the database that we will create -$databaseuser = 'root'; // The name of a user with rights to create db (or if db already exists, then rights within that db) -$databasepass = ''; // Password of db user +$databasename = 'sondagespro_lssvn'; // The name of the database that we will create +$databaseuser = 'sondagespro'; // The name of a user with rights to create db (or if db already exists, then rights within that db) +$databasepass = 'u3BWRZdczah4GZ6m'; // Password of db user $dbprefix = 'lime_'; // A global prefix that can be added to all LimeSurvey tables. Use this if you are sharing -// a database with other applications. Suggested prefix is 'lime_' + // a database with other applications. Suggested prefix is 'lime_' // File Locations -$rooturl = "http://{$_SERVER['HTTP_HOST']}/limesurvey"; // The root web url for your limesurvey installation (without a trailing slash). +// File Locations +$rooturl = "http://{$_SERVER['HTTP_HOST']}"; // The root web url for your limesurvey installation (without a trailing slash). // The double quotes (") are important. -$rootdir = dirname(__FILE__); // This is the physical disk location for your limesurvey installation. Normally you don't have to touch this -// setting. If you use IIS then you MUST enter the complete rootdir e.g. : $rootDir='C:\Inetpub\wwwroot\limesurvey'! -// Some IIS and OS/2 installations also require to use forward slashes -// instead of backslashes, e.g. $rootDir='C:/Inetpub/wwwroot/limesurvey'! +$rootdir = dirname(__FILE__); // This is the physical disk location for your limesurvey installation. Normally you don't have to touch this + // setting. If you use IIS then you MUST enter the complete rootdir e.g. : $rootDir='C:\Inetpub\wwwroot\limesurvey'! + // Some IIS and OS/2 installations also require to use forward slashes + // instead of backslashes, e.g. $rootDir='C:/Inetpub/wwwroot/limesurvey'! // Installation Setup -$defaultuser = 'admin'; // This is the username when LimeSurvey is installed and the administration user is created on installation -$defaultpass = 'password'; // This is the password for the administration user when LimeSurvey is installed +$defaultuser = 'shnoulle'; // This is the username when LimeSurvey is installed and the administration user is created on installation +$defaultpass = 'motdepasse'; // This is the password for the administration user when LimeSurvey is installed + // Debug Settings -$debug = 0; // Set this to 1 if you are looking for errors. If you still get no errors after enabling this +$debug = 3; // Set this to 1 if you are looking for errors. If you still get no errors after enabling this // then please check your error-logs - either in your hosting provider admin panel or in some /logs dir // on your webspace. // LimeSurvey developers: Set this to 3 to circumvent the restriction to remove the installation directory and full access to standard templates // or to change the password. If you set it to 3 then PHP STRICT warnings will be shown additionally. + +$demoModeOnly = false; +$modrewrite = 1; + diff --git a/scripts/em_javascript.js b/scripts/em_javascript.js index 98004b9..7d96588 100644 --- a/scripts/em_javascript.js +++ b/scripts/em_javascript.js @@ -2495,4 +2495,21 @@ function time () { // * example 1: timeStamp = time(); // * results 1: timeStamp > 1000000000 && timeStamp < 2000000000 return Math.floor(new Date().getTime() / 1000); -} \ No newline at end of file +} + +// replace hide function by lsemHide +jQuery.fn.lsemHide = function(hideMode) { + if(hideMode=='input'){ + $(this).find('input').css('visibility','hidden'); + }else{ + $(this).hide(); + } +}; +jQuery.fn.lsemShow = function(hideMode) { + if(hideMode=='input'){ + $(this).show(); + $(this).find('input').css('visibility',''); + }else{ + $(this).show(); + } +}; diff --git a/scripts/survey_runtime.js b/scripts/survey_runtime.js index 807133e..84f25d1 100644 --- a/scripts/survey_runtime.js +++ b/scripts/survey_runtime.js @@ -1001,3 +1001,4 @@ function textLimit(field, maxlen) { document.getElementById(field).value = document.getElementById(field).value.substring(0, maxlen); } } + | ||||
Bug heat | 16 | ||||
Complete LimeSurvey version number (& build) | 120311 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | |||||
Database type & version | ? | ||||
Server OS (if known) | ? | ||||
Webserver software & version (if known) | ? | ||||
PHP Version | ? | ||||
This is how it is designed to work - acts like array_filter. However, since some users are finding this confusing, we're checking whether we can replicate the old behavior and still support cascading relevance properly. |
|
My suggestion: Enhance the EM logic to 'If it a EM behaviour has effect (relevancy) on the very same question it was originating from then only visually disable (instead of hiding) the related inputs? That would follow a logical strict rule and maintain usability. |
|
<q>That would follow a logical strict rule and maintain usability. </q> Same for array_filter ? Seem very difficult no ? Maybe : |
|
Having that sort of advanced option might be easier. That way I could keep the relevance processing intact, but instead of calling .show(), or .hide(), I'd call |
|
Actually, using disabled looks very strange when used for array_filter and array_filter exclude. So, will need to refactor code to separate exclusive option out of array filter processing and let just exclusive options utilize the "disabled" approach. |
|
With advanced setting: and relevanceTrue(setting){ } Something like that maybe. |
|
The 'Advanced question settings' option sounds fine. |
|
Denis - I like your approach discussed here - http://www.limesurvey.org/forum/design-issues/78545-exclusive-options-for-multiple-choice-not-working?lang=en#78567 |
|
Tom: did i have "why" subquestion are hidden in LimeExpressionManager . Something like 'hide_attribute_exclude' or 'hide_attribute_arrayfilter' or .... Or a way to find it. Denis PS: sorry .... $qattr :) |
|
Not only javascript solution, Need too to review return_array_filter_strings too. I don't see a good solution actually. Actual working draft joined in diff. Alternate solution: |
|
Update the patch for April 19 Git version. Actually : work with javascript only, not with Previous button (or reload survey). I'm not sure for patching ... 1st: need patch to return_array_filter_strings function (qanda.php) : need more SESSION information, add a $_SESSION['relevanceStatus'][$rowname]['why'] ? Empty or not set by default. Review totally ExpressionManager Class to have the reason of hide reason (think need a lot of work ;) ). 2nd : remove exclude_all_others/exclude_all_others_auto from ExpressionManager and do it only in Javascript and do_multiplechoice function. I don't see the good solution. |
|
I think we should separate the array filter code and the exclusive option code. Array filter works great the way it is, but the exclusive option should only disable other options so you still see what alternative answer options exist. This is the original behavior and our long term users expect it to work this way and it also makes more sense that way. The new design for the exclusive option is also irritating because you can't say if previously chosen answers are saved if you switch to the exclusive option (tested: they are not stored which is fine). |
|
Ok, Thanks Mazi, work on option 2 then :) Denis |
|
Shnoulle- I think there is an easier solution that guarantees continued support for cascading relevance without the need for patching qanda or adding more SESSION details. I have some free time today if you want me to take a stab at this. |
|
My actual option is to remove exclude_all_others and exclude_all_others_auto from Expression Manager ... Then Go go ! Thank you ! [Edit : The -> Then] |
|
Still working on it. Wasn't too hard to get it working for single questions, or even cascaded ones. What's hard is undoing it in the following situation: Q1: A-J + NA. exclude_all_others = "NA" With current status, initial filtering works fine. However, if I click "E" in Q1 so that I can see it in Q2 (plus B-G so I can see other options), then click "E" in Q2 (that properly causes the rest of Q2 to be disabled). However, if I unclick E in Q1, E in Q2 should be irrelevant, so all of the questions disabled by E should be re-enabled, and all downstream questions should be properly parsed. Not sure if anyone would ever do this, but this highlights the fact that it isn't a trivial fix. |
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=8467 |
|
Fix committed to Yii branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=8471 |
|
New 1.92+ version released. |
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=8644 |
|
Fix committed to Yii branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=8645 |
|
When revisit (prev) a question that has array_filter_exclude disabled sub-questions, they are hidden rather than disabled. |
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=8670 |
|
Fix committed to Yii branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=8671 |
|
New 1.91+ build released. |
|
LimeSurvey: master ff03709d 2012-05-15 10:42 Details Diff |
Fixed issue 05943: exclusive option in multiple choice hide all other answer options Dev tested to confirm that this works for (a) multiple exclude_all_other options, and (b) cascading array_filter(_exclude) so that if an exclude_all_others row becomes irrelevant, the non-excluded options become re-enabled |
Affected Issues 05943 |
|
mod - classes/expressions/LimeExpressionManager.php | Diff File | ||
mod - qanda.php | Diff File | ||
LimeSurvey: Yii c16bb49d 2012-05-15 11:53 Details Diff |
Fixed issue 05943: exclusive option in multiple choice hide all other answer options |
Affected Issues 05943 |
|
mod - application/helpers/expressions/em_manager_helper.php | Diff File | ||
mod - application/helpers/qanda_helper.php | Diff File | ||
LimeSurvey: master 36794a55 2012-06-05 01:16 Details Diff |
Fixed issue 05943: exclusive option in multiple choice hide all other answer options Dev Author can choose between having array_filter(_exclude) hide vs. disable the filtered values |
Affected Issues 05943 |
|
mod - classes/expressions/LimeExpressionManager.php | Diff File | ||
mod - common_functions.php | Diff File | ||
LimeSurvey: Yii 33de9732 2012-06-05 01:18 Details Diff |
Fixed issue 05943: exclusive option in multiple choice hide all other answer options Dev Author can choose between having array_filter(_exclude) hide vs. disable the filtered values |
Affected Issues 05943 |
|
mod - application/helpers/common_helper.php | Diff File | ||
mod - application/helpers/expressions/em_manager_helper.php | Diff File | ||
LimeSurvey: master 9f53eade 2012-06-06 20:49 Details Diff |
Fixed issue 05943: exclusive option in multiple choice hide all other answer options Dev Upon revisiting a question, sub-questions that should have been disabled were being hidden instead |
Affected Issues 05943 |
|
mod - qanda.php | Diff File | ||
LimeSurvey: Yii 27afbda5 2012-06-06 20:51 Details Diff |
Fixed issue 05943: exclusive option in multiple choice hide all other answer options Dev Upon revisiting a question, sub-questions that should have been disabled were being hidden instead |
Affected Issues 05943 |
|
mod - application/helpers/qanda_helper.php | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-03-22 11:58 | ResearchOnBlogs | New Issue | |
2012-03-22 12:23 | TMSWhite | Note Added: 18042 | |
2012-03-22 23:54 | c_schmitz | Note Added: 18049 | |
2012-03-23 16:27 | c_schmitz | Assigned To | => DenisChenu |
2012-03-23 16:27 | c_schmitz | Status | new => assigned |
2012-03-23 16:27 | c_schmitz | Assigned To | DenisChenu => TMSWhite |
2012-03-23 17:19 | DenisChenu | Note Added: 18069 | |
2012-03-23 17:26 | TMSWhite | Note Added: 18070 | |
2012-03-24 06:47 | TMSWhite | Note Added: 18075 | |
2012-03-25 11:58 | DenisChenu | Note Added: 18083 | |
2012-03-26 18:34 | c_schmitz | Note Added: 18089 | |
2012-04-13 16:33 | TMSWhite | Assigned To | TMSWhite => DenisChenu |
2012-04-13 16:34 | TMSWhite | Note Added: 18351 | |
2012-04-13 17:57 | DenisChenu | Note Added: 18354 | |
2012-04-13 18:58 | DenisChenu | Note Edited: 18354 | |
2012-04-14 13:26 | DenisChenu | File Added: diff5943.diff | |
2012-04-14 13:27 | DenisChenu | File Deleted: diff5943.diff | |
2012-04-14 13:28 | DenisChenu | File Added: diff5943.diff | |
2012-04-14 13:28 | DenisChenu | Note Added: 18356 | |
2012-04-14 13:30 | DenisChenu | Note Edited: 18356 | |
2012-04-19 12:43 | DenisChenu | File Added: diff5943_120419.diff | |
2012-04-19 12:44 | DenisChenu | File Deleted: diff5943.diff | |
2012-04-19 12:44 | DenisChenu | File Added: limesurvey_survey_58796.lss | |
2012-04-19 12:56 | DenisChenu | Note Added: 18431 | |
2012-04-19 12:56 | DenisChenu | Issue Monitored: c_schmitz | |
2012-05-09 21:40 | Mazi | Note Added: 18648 | |
2012-05-09 22:56 | DenisChenu | Note Added: 18649 | |
2012-05-11 13:38 | TMSWhite | Note Added: 18698 | |
2012-05-11 13:42 | DenisChenu | Note Added: 18699 | |
2012-05-11 13:43 | DenisChenu | Assigned To | DenisChenu => TMSWhite |
2012-05-11 13:43 | DenisChenu | Note Edited: 18699 | |
2012-05-15 01:00 | TMSWhite | Note Added: 18752 | |
2012-05-15 17:43 | TMSWhite | Changeset attached | => LimeSurvey master ff03709d |
2012-05-15 17:43 | TMSWhite | Note Added: 18759 | |
2012-05-15 17:43 | TMSWhite | Resolution | open => fixed |
2012-05-15 18:55 | TMSWhite | Changeset attached | => LimeSurvey Yii c16bb49d |
2012-05-15 18:55 | TMSWhite | Note Added: 18764 | |
2012-05-15 18:55 | TMSWhite | Status | assigned => resolved |
2012-05-15 18:55 | TMSWhite | Fixed in Version | => 1.92+ |
2012-05-17 10:27 | c_schmitz | Note Added: 18814 | |
2012-05-17 10:27 | c_schmitz | Status | resolved => closed |
2012-06-05 08:19 | TMSWhite | Changeset attached | => LimeSurvey master 36794a55 |
2012-06-05 08:19 | TMSWhite | Note Added: 19070 | |
2012-06-05 08:19 | TMSWhite | Changeset attached | => LimeSurvey Yii 33de9732 |
2012-06-05 08:19 | TMSWhite | Note Added: 19071 | |
2012-06-07 02:38 | TMSWhite | Note Added: 19088 | |
2012-06-07 02:38 | TMSWhite | Status | closed => feedback |
2012-06-07 02:38 | TMSWhite | Resolution | fixed => reopened |
2012-06-07 03:52 | TMSWhite | Changeset attached | => LimeSurvey master 9f53eade |
2012-06-07 03:52 | TMSWhite | Note Added: 19089 | |
2012-06-07 03:52 | TMSWhite | Changeset attached | => LimeSurvey Yii 27afbda5 |
2012-06-07 03:52 | TMSWhite | Note Added: 19090 | |
2012-06-07 03:53 | TMSWhite | Status | feedback => resolved |
2012-06-07 03:53 | TMSWhite | Resolution | reopened => fixed |
2012-06-07 11:02 | c_schmitz | Note Added: 19093 | |
2012-06-07 11:02 | c_schmitz | Status | resolved => closed |
2021-08-03 05:34 | guest | Bug heat | 14 => 16 |