Skip to content

[Bug]: Save settings button is not associated with any form (button.form === null), so nothing happens on click #166

Open

Description

@BurkhardFS

Preflight checks

  • I searched existing issues and discussions and did not find a duplicate.
  • I am running a currently released version (or main), not a very old build.

CaddyUI version

v2.68.6

Caddy version

v2.11.7

Install method

Docker (applegater/caddyui)

Database backend

SQLite (default)

Browser and OS

Chrome 156.0.8078.81 on Windows 11 64bit | Firefox 159 on Windows 11 64bit

Steps to reproduce

  1. Log in and open Settings → Backup (/settings/backup)
  2. Tick "Scheduled backups", enter a directory (e.g. /backups), interval and keep count
  3. Click "Save settings"
  4. Nothing happens (no request in the Network tab); reload the page

Expected behavior

The backup settings fields and both buttons are inside the

so that "Save settings" submits them (with the CSRF token and settings_section=backup) and the values persist. "Back up now" should also submit within that form so it is sent with the CSRF token.

Actual behavior

Clicking "Save settings" on Settings → Backup does nothing, and the scheduled-backup values are not persisted (after reload the fields are empty again and the checkbox is unchecked).

Cause: the (with csrf_token and settings_section=backup) is closed before the #settings-backup section starts. The checkbox "backup_schedule_enabled", the inputs "backup_schedule_dir", "backup_schedule_interval_hours", "backup_schedule_keep" and both buttons ("Save settings", "Back up now") are therefore not inside any . button.form === null for both buttons.

Ancestor chain of the button:
BUTTON < DIV.flex < DIV.mt-5 < DIV#settings-backup < DIV.min-w-0 < DIV.lg:flex < DIV.app-content < MAIN#main-content < DIV#app-scroll < DIV.app-shell < BODY < HTML

Relevant logs / output

document.querySelector('#settings-backup button[type=submit]').form // null

Wrapping #settings-backup in as a manual test returns:
POST http://localhost:8081/settings/backup net::ERR_HTTP_RESPONSE_CODE_FAILURE 405 (Method Not Allowed)

Suggested fix:
move the closing </form> of the <form action="/settings"> to after the #settings-backup section (or move the fields into that form).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions