diff --git a/html/network.php b/html/network.php
index 2362ad1..8ccb26c 100755
--- a/html/network.php
+++ b/html/network.php
@@ -23,6 +23,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['action'])) {
$interface = $_POST['interface'] ?? '';
$action = $_POST['action'];
+ $multicast = isset($_POST['multicast']) ? 'on' : 'off';
if ($action === 'save') {
// Save configuration
@@ -33,7 +34,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
'netmask' => $_POST['netmask'] ?? '',
'gateway' => $_POST['gateway'] ?? '',
'dns' => $_POST['dns'] ?? '',
- 'multicast' => $_POST['multicast'] ?? 'off'
+ 'multicast' => $multicast
];
$network_config[$interface] = $config;
@@ -158,16 +159,23 @@ $selected_interface = $_GET['interface'] ?? array_keys($interface_data)[0] ?? nu
-
-
@@ -265,24 +273,32 @@ $selected_interface = $_GET['interface'] ?? array_keys($interface_data)[0] ?? nu
// Multicast toggle switch functionality - simplified approach
document.addEventListener('DOMContentLoaded', function() {
- // Add event listeners to all multicast checkboxes
- const checkboxes = document.querySelectorAll('input[id^="multicast-"]');
-
- checkboxes.forEach(checkbox => {
- checkbox.addEventListener('change', function() {
- // Extract interface name from ID (format: multicast-eth0)
- const idParts = this.id.split('-');
- const interfaceName = idParts[1]; // Get the interface name part
-
- if (interfaceName) {
- const label = document.getElementById(`multicast-label-${interfaceName}`);
- if (label) {
- // Update label text based on checkbox state
- label.textContent = this.checked ? 'Enabled' : 'Disabled';
- }
+
+ document.querySelectorAll('.multicast-toggle').forEach(function(checkbox) {
+
+ checkbox.addEventListener('click', function() {
+
+ const interfaceName = this.id.replace('multicast-', '');
+
+ const label = document.getElementById(
+ 'multicast-label-' + interfaceName
+ );
+
+ if (label) {
+ label.textContent = this.checked ?
+ 'Enabled' :
+ 'Disabled';
}
+
+ console.log(
+ 'Multicast:',
+ interfaceName,
+ this.checked ? 'on' : 'off'
+ );
});
+
});
+
});