Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion www/form/app-form.less
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,6 @@
hyphens: auto;
text-align: center;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
}
Expand Down
24 changes: 24 additions & 0 deletions www/form/inner.js
Original file line number Diff line number Diff line change
Expand Up @@ -4707,6 +4707,24 @@ define([
return;
}

// Function to renumber visible questions sequentially
var updateQuestionNumbers = function () {
var visibleNumber = 1;
$container.find('.cp-form-block').each(function () {
var $block = $(this);
var $questionNumber = $block.find('.cp-form-block-question-number');

// Skip static blocks (they don't have question numbers) or blocks without question numbers
if (!$questionNumber.length) { return; }

// Check if the block is visible
if ($block.is(':visible')) {
$questionNumber.text(visibleNumber + '.');
visibleNumber++;
}
});
};

// In view mode, hide sections when conditions aren't met
evOnChange.reg(function (reset, save, condition) {
if (!reset && !condition) { return; }
Expand All @@ -4721,6 +4739,9 @@ define([
$container.find('.cp-form-block[data-id="'+_uid+'"]').toggle(show);
});
});

// Update question numbers to maintain sequential display
updateQuestionNumbers();
});

// If the form is already submitted, show an info message
Expand Down Expand Up @@ -4774,6 +4795,9 @@ define([
if (!answers) {
$container.find('.cp-reset-button').attr('disabled', 'disabled');
}

// Initial call to ensure sequential numbering after conditional blocks are processed
updateQuestionNumbers();
};

var getTempFields = function () {
Expand Down