Skip to content

Commit 490356e

Browse files
committed
fix(question): show / hode specific properties
Signed-off-by: Thierry Bugier <[email protected]>
1 parent 29b0a47 commit 490356e

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

inc/question.class.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -841,28 +841,36 @@ public function showForm($ID, $options = []) {
841841
echo '<tr>';
842842
// required
843843
echo '<td>';
844-
echo '<label for="dropdown_required'.$rand.'" id="label_required">';
844+
echo '<div class="plugin_formcreator_required">';
845+
echo '<label for="dropdown_required'.$rand.'">';
845846
echo __('Required', 'formcreator');
846847
echo '</label>';
848+
echo '</div>';
847849
echo '</td>';
848850

849-
echo '<td id="plugin_formcreator_required">';
851+
echo '<td>';
852+
echo '<div class="plugin_formcreator_required">';
850853
dropdown::showYesNo('required', $this->fields['required'], -1, [
851854
'rand' => $rand,
852855
]);
856+
echo '</div>';
853857
echo '</td>';
854858

855859
// show empty
856860
echo '<td>';
857-
echo '<label for="dropdown_show_empty'.$rand.'" id="label_show_empty">';
861+
echo '<div class="plugin_formcreator_mayBeEmpty">';
862+
echo '<label for="dropdown_show_empty'.$rand.'">';
858863
echo __('Show empty', 'formcreator');
859864
echo '</label>';
865+
echo '</div>';
860866
echo '</td>';
861867

862-
echo '<td id="plugin_formcreator_show_empty">';
868+
echo '<td>';
869+
echo '<div class="plugin_formcreator_mayBeEmpty">';
863870
dropdown::showYesNo('show_empty', $this->fields['show_empty'], -1, [
864871
'rand' => $rand,
865872
]);
873+
echo '</div>';
866874
echo '</td>';
867875
echo '</tr>';
868876

js/scripts.js.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,15 +1084,8 @@ function plugin_formcreator_changeQuestionType(rand) {
10841084
return;
10851085
}
10861086

1087-
$('#label_required').toggle(response.may_be_required);
1088-
$('#plugin_formcreator_required > [name="required"]').toggle(response.may_be_required);
1089-
1090-
$('#label_show_empty').toggle(response.may_be_empty);
1091-
$('#plugin_formcreator_show_empty > [name="show_empty"]').toggle(response.may_be_empty);
1092-
1093-
$('#plugin_formcreator_subtype_label').html(response.label);
1094-
$('#plugin_formcreator_subtype_value').html(response.field);
1095-
1087+
$('.plugin_formcreator_required').toggle(response.may_be_required);
1088+
$('.plugin_formcreator_mayBeEmpty').toggle(response.may_be_empty);
10961089
plugin_formcreator_updateQuestionSpecific(response.additions);
10971090
});
10981091
}

0 commit comments

Comments
 (0)