fix: Add bracket notation to checkbox-group input names

The backend expects checkbox groups to submit with bracket notation
(request.form.getlist("<field>[]")), but the templates were rendering
checkboxes without the "[]" suffix in the name attribute.

Changes:
1. Add name="{{ full_key }}[]" to checkbox inputs in plugin_config.html
2. Add name="${fullKey}[]" to checkbox inputs in plugins_manager.js

This ensures:
- Checked checkboxes submit their values with the bracket notation
- Backend can use request.form.getlist("<field>[]") to collect all values
- Sentinel hidden input (already using bracket notation) works correctly
- Backend bracket_array_fields logic receives and processes the array values

The sentinel hidden input ensures the field is always submitted (even
when all checkboxes are unchecked), allowing the backend to detect and
set empty arrays correctly.
This commit is contained in:
Chuck
2026-01-11 15:41:47 -05:00
parent 16f0702c0c
commit 60aad56d0e
2 changed files with 2 additions and 0 deletions

View File

@@ -3021,6 +3021,7 @@ function generateFieldHtml(key, prop, value, prefix = '') {
<label class="flex items-center">
<input type="checkbox"
id="${checkboxId}"
name="${fullKey}[]"
data-checkbox-group="${fieldId}"
data-option-value="${escapeHtml(option)}"
value="${escapeHtml(option)}"

View File

@@ -168,6 +168,7 @@
<label class="flex items-center cursor-pointer">
<input type="checkbox"
id="{{ checkbox_id }}"
name="{{ full_key }}[]"
data-checkbox-group="{{ field_id }}"
data-option-value="{{ option }}"
value="{{ option }}"