diff --git a/inc/condition.class.php b/inc/condition.class.php index c08847510..aab435418 100644 --- a/inc/condition.class.php +++ b/inc/condition.class.php @@ -376,14 +376,13 @@ public function getConditionHtml(array $input) : string { PluginFormcreatorSection::getForeignKeyField() => $sectionsList, ]; $html.= '
'; - $html.= PluginFormcreatorQuestion::dropdown( + $html .= PluginFormcreatorQuestion::dropdownForForm( + $form->getID(), + $questionListExclusion, + '_conditions[plugin_formcreator_questions_id][]', + $questionId, [ - 'name' => '_conditions[plugin_formcreator_questions_id][]', - 'value' => $questionId, - 'comments' => false, - 'condition' => $questionListExclusion, - 'rand' => $rand, - 'display' => false, + 'display' => false, ] ); $html.= '
'; diff --git a/inc/question.class.php b/inc/question.class.php index 71f5b885b..0db261ee4 100644 --- a/inc/question.class.php +++ b/inc/question.class.php @@ -1114,10 +1114,16 @@ public function getQuestionsFromFormBySection($formId, $crit = []) { return $items; } - public static function dropdownForForm($formId, $crit, $name, $value) { + public static function dropdownForForm($formId, $crit, $name, $value, $options = []) { $question = new self(); $items = $question->getQuestionsFromFormBySection($formId, $crit); - Dropdown::showFromArray($name, $items, $value); + $options = [ + 'display' => $options['display'] ?? true, + 'value' => $value, + ]; + $output = Dropdown::showFromArray($name, $items, $options); + + return $output; } /**