Skip to content

Commit

Permalink
fix(question): show / hode specific properties
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Feb 7, 2020
1 parent 29b0a47 commit 490356e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
16 changes: 12 additions & 4 deletions inc/question.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -841,28 +841,36 @@ public function showForm($ID, $options = []) {
echo '<tr>';
// required
echo '<td>';
echo '<label for="dropdown_required'.$rand.'" id="label_required">';
echo '<div class="plugin_formcreator_required">';
echo '<label for="dropdown_required'.$rand.'">';
echo __('Required', 'formcreator');
echo '</label>';
echo '</div>';
echo '</td>';

echo '<td id="plugin_formcreator_required">';
echo '<td>';
echo '<div class="plugin_formcreator_required">';
dropdown::showYesNo('required', $this->fields['required'], -1, [
'rand' => $rand,
]);
echo '</div>';
echo '</td>';

// show empty
echo '<td>';
echo '<label for="dropdown_show_empty'.$rand.'" id="label_show_empty">';
echo '<div class="plugin_formcreator_mayBeEmpty">';
echo '<label for="dropdown_show_empty'.$rand.'">';
echo __('Show empty', 'formcreator');
echo '</label>';
echo '</div>';
echo '</td>';

echo '<td id="plugin_formcreator_show_empty">';
echo '<td>';
echo '<div class="plugin_formcreator_mayBeEmpty">';
dropdown::showYesNo('show_empty', $this->fields['show_empty'], -1, [
'rand' => $rand,
]);
echo '</div>';
echo '</td>';
echo '</tr>';

Expand Down
11 changes: 2 additions & 9 deletions js/scripts.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -1084,15 +1084,8 @@ function plugin_formcreator_changeQuestionType(rand) {
return;
}

$('#label_required').toggle(response.may_be_required);
$('#plugin_formcreator_required > [name="required"]').toggle(response.may_be_required);

$('#label_show_empty').toggle(response.may_be_empty);
$('#plugin_formcreator_show_empty > [name="show_empty"]').toggle(response.may_be_empty);

$('#plugin_formcreator_subtype_label').html(response.label);
$('#plugin_formcreator_subtype_value').html(response.field);

$('.plugin_formcreator_required').toggle(response.may_be_required);
$('.plugin_formcreator_mayBeEmpty').toggle(response.may_be_empty);
plugin_formcreator_updateQuestionSpecific(response.additions);
});
}
Expand Down

0 comments on commit 490356e

Please sign in to comment.