Skip to content

Commit

Permalink
Fixed issue #05711: Auto tab ordering no longer working
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_dev@12401 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
tmswhite committed Feb 8, 2012
1 parent 0b5692e commit 7eca5e5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
5 changes: 4 additions & 1 deletion classes/eval/LimeExpressionManager.php
Expand Up @@ -4825,7 +4825,10 @@ static function GetRelevanceAndTailoringJavaScript()

$jsParts[] = "function ExprMgr_process_relevance_and_tailoring(evt_type){\n";
$jsParts[] = "if (typeof LEM_initialized == 'undefined') {\nLEM_initialized=true;\nLEMsetTabIndexes();\n}\n";
$jsParts[] = "if (evt_type == 'onchange' && (typeof last_evt_type != 'undefined' && last_evt_type == 'keydown') && (typeof target_tabIndex != 'undefined' && target_tabIndex == document.activeElement.tabIndex)) {\nreturn;\n}\n";
$jsParts[] = "if (evt_type == 'onchange' && (typeof last_evt_type != 'undefined' && last_evt_type == 'keydown')) {\n";
$jsParts[] = " last_evt_type='onchange';\n";
$jsParts[] = " return;\n";
$jsParts[] = "}\n";
$jsParts[] = "last_evt_type = evt_type;\n\n";

// flatten relevance array, keeping proper order
Expand Down
3 changes: 2 additions & 1 deletion classes/eval/em_javascript.js
Expand Up @@ -495,10 +495,11 @@ function LEManyNA()
function LEMsetTabIndexes()
{
if (typeof tabIndexesSet == 'undefined') {
$(':input[type!=hidden][id!=runonce]').each(function(index){
$('#limesurvey :input[type!=hidden][id!=runonce]').each(function(index){
$(this).bind('keydown',function(e) {
if (e.keyCode == 9) {
ExprMgr_process_relevance_and_tailoring(e.type);
$(this).focus();
return true;
}
return true;
Expand Down
3 changes: 2 additions & 1 deletion classes/eval/test/relevance.php
Expand Up @@ -8,8 +8,9 @@
<title>ExpressionManager: Unit Test Relevance</title>
<script type="text/javascript" src="../scripts/jquery/jquery.js"></script>
<script type="text/javascript" src="../classes/eval/em_javascript.js"></script>
<script type="text/javascript" src="../scripts/survey_runtime.js"></script>
</head>
<body id="limesurvey" onload="ExprMgr_process_relevance_and_tailoring('');">
<body id="limesurvey">
<?php
// include_once('../LimeExpressionManager.php');
LimeExpressionManager::UnitTestRelevance();
Expand Down
2 changes: 1 addition & 1 deletion group.php
Expand Up @@ -713,7 +713,7 @@ function checkconditions(value, name, type)
document.getElementById(hiddenformname).value='';
}
}
ExprMgr_process_relevance_and_tailoring();
ExprMgr_process_relevance_and_tailoring('onchange');
}
// -->
</script>
Expand Down
4 changes: 1 addition & 3 deletions scripts/survey_runtime.js
Expand Up @@ -2,6 +2,7 @@ var DOM1;
$(document).ready(function()
{
DOM1 = (typeof document.getElementsByTagName!='undefined');
if (typeof LEMsetTabIndexes === 'function') { LEMsetTabIndexes(); }
if (typeof checkconditions!='undefined') checkconditions();
if (typeof template_onload!='undefined') template_onload();
prepareCellAdapters();
Expand Down Expand Up @@ -119,9 +120,6 @@ $(document).ready(function()
var row = $("#index .row.current");
idx.scrollTop(row.position().top - idx.height() / 2 - row.height() / 2);
*/
// if (typeof ExprMgr_process_relevance_and_tailoring === 'function') {
// ExprMgr_process_relevance_and_tailoring();
// }
});

gmaps = new Object;
Expand Down

0 comments on commit 7eca5e5

Please sign in to comment.