Skip to content

Commit 6bdf21b

Browse files
committed
Add comments
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
1 parent 81e6912 commit 6bdf21b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

js/dynamic_form.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,15 @@ function initPersons(prefix, legend) {
216216
const container = document.getElementById(`${prefix}_list`);
217217
if (!container) return;
218218

219+
// If there are already persons, do not add new ones,
220+
// renumber them if needed.
219221
const existing = Array.from(container.querySelectorAll('.person'));
220222
if (existing.length > 0) {
221223
renumberPersons(prefix);
222224
return;
223225
}
224226

227+
// If no persons, add empty ones
225228
const nbPersons = getNbPersons(prefix);
226229
for (let i = 0; i < nbPersons; i++) {
227230
addPerson(prefix, legend);

0 commit comments

Comments
 (0)