Skip to content

Commit

Permalink
fix(condition): change again the way to hide questions and sections
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Apr 2, 2020
1 parent fcc49a9 commit 590fbd5
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions js/scripts.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -626,11 +626,9 @@ function formcreatorShowFields(form) {
var sectionId = parseInt(sectionKey);
if (!isNaN(sectionId)) {
if (sectionToShow[sectionId]) {
$('div[data-section-id="' + sectionId+ '"]').css('visibility', '');
$('div[data-section-id="' + sectionId+ '"]').css('height', '');
$('div[data-section-id="' + sectionId+ '"]').removeAttr('hidden', '');
} else {
$('div[data-section-id="' + sectionId+ '"]').css('visibility', 'hidden');
$('div[data-section-id="' + sectionId+ '"]').css('height', '0');
$('div[data-section-id="' + sectionId+ '"]').attr('hidden', '');
}
}
}
Expand All @@ -640,14 +638,12 @@ function formcreatorShowFields(form) {
questionId = parseInt(questionKey.replace('formcreator_field_', ''));
if (!isNaN(questionId)) {
if (questionToShow[questionKey]) {
$('#form-group-field-' + questionKey).css('visibility', '');
$('#form-group-field-' + questionKey).css('height', '');
$('#form-group-field-' + questionKey).removeAttr('hidden');
i++;
$('#form-group-field-' + questionKey).removeClass('line' + (i+1) % 2);
$('#form-group-field-' + questionKey).addClass('line' + i%2);
} else {
$('#form-group-field-' + questionKey).css('visibility', 'hidden');
$('#form-group-field-' + questionKey).css('height', '0');
$('#form-group-field-' + questionKey).attr('hidden', '');
$('#form-group-field-' + questionKey).removeClass('line0');
$('#form-group-field-' + questionKey).removeClass('line1');
}
Expand Down

0 comments on commit 590fbd5

Please sign in to comment.