mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 05:13:01 +00:00
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:
@@ -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)}"
|
||||
|
||||
Reference in New Issue
Block a user