Skip to content

Commit

Permalink
Fixed issue #18835: Array question doesn't reload anwsers (#3162)
Browse files Browse the repository at this point in the history
Dev: CHECKED !== checked
  • Loading branch information
Shnoulle committed May 23, 2023
1 parent 5809428 commit b9560e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,14 @@ public function __construct($aFieldArray, $bRenderDirect = false)

$aLastMoveResult = LimeExpressionManager::GetLastMoveResult();
$this->aMandatoryViolationSubQ = ($aLastMoveResult['mandViolation'] && $this->oQuestion->mandatory == 'Y') ? explode("|", (string) $aLastMoveResult['unansweredSQs']) : [];

$this->repeatheadings = Yii::app()->getConfig("repeatheadings");
$this->minrepeatheadings = Yii::app()->getConfig("minrepeatheadings");

if (ctype_digit((string) $this->repeatheadings) && !empty($this->repeatheadings)) {
$this->repeatheadings = intval($this->getQuestionAttribute('repeat_headings'));
$this->minrepeatheadings = 0;
}



if ($this->getQuestionAttribute('use_dropdown') == 1) {
$this->bUseDropdownLayout = true;
$this->sCoreClass .= " dropdown-array";
Expand All @@ -62,7 +60,7 @@ public function __construct($aFieldArray, $bRenderDirect = false)
// I suppose this is irrelevant and if not, why t** f*** is there hardcoded text in the renderer function?
//$caption = gT("A table with a subquestion on each row. The answer options are contained in the table header.");
}

$this->setSubquestions();
$this->setAnsweroptions();

Expand Down Expand Up @@ -183,7 +181,6 @@ public function setHeaders($isrepeat = false)

public function getDropdownRows()
{

// $labels[] = array(
// 'code' => $aAnswer->code,
// 'answer' => $aAnswer->answerl10ns[$sSurveyLanguage]->answer
Expand Down Expand Up @@ -290,20 +287,19 @@ public function getNonDropdownRows()
'ld' => $oAnswer->code,
'code' => $oAnswer->code,
'label' => $oAnswer->answerl10ns[$this->sLanguage]->answer,
'checked' => ($this->getFromSurveySession($myfname) == $oAnswer->code) ? 'checked' : '',
'checked' => ($value == $oAnswer->code) ? 'checked' : '',
);
}

$aNoAnswerColumn = [];
if (($this->oQuestion->mandatory != 'Y' && SHOW_NO_ANSWER == 1)) {
$checked = (!isset($_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$myfname]) || $_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$myfname] == '') ? 'CHECKED' : '';
$aNoAnswerColumn = array(
'basename' => $this->sSGQA,
'myfname' => $myfname,
'ld' => '',
'code' => $oAnswer->code,
'label' => gT('No answer'),
'checked' => $checked,
'checked' => (is_null($value) || $value === '') ? 'checked' : '',
);
}

Expand Down Expand Up @@ -374,7 +370,6 @@ public function render($sCoreClasses = '')
{

//return @do_array($this->aFieldArray);

$answer = '';
$answer .= Yii::app()->twigRenderer->renderQuestion($this->getMainView() . '/answer', array(
'anscount' => $this->getQuestionCount(),
Expand All @@ -392,7 +387,6 @@ public function render($sCoreClasses = '')
return array($answer, $this->inputnames);
}


protected function getAnswerCount($iScaleId = 0)
{
// Getting answerrcount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
value="{{ ld }}"
id="answer{{ myfname }}-{{ ld }}"
aria-labelledby="answer{{ basename }}-{{ ld }}"
{{ CHECKED }}
{{ checked }}
/>
<label for="answer{{ myfname }}-{{ ld }}" class="ls-label-xs-visibility" aria-hidden="true">
{{ processString(label) }}
Expand Down

0 comments on commit b9560e7

Please sign in to comment.