Skip to content

[3.0] Theme split (wave 4, part 3) — fix the auto-submitting continue buttons - #9386

Open
albertlast wants to merge 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/theme-autosubmit
Open

[3.0] Theme split (wave 4, part 3) — fix the auto-submitting continue buttons#9386
albertlast wants to merge 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/theme-autosubmit

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

Description

Part of the split of #7933, wave 4 part 3.

doAutoSubmit() finds the countdown button by name, defaulting to cont:

function doAutoSubmit(countdown, txtMessage, formName = 'autoSubmit', fieldName = 'cont') {
	const form = document.forms[formName];
	...
	const contField = form.elements[fieldName];

template_not_done() names its button cont and calls it with the defaults. Three
other progress pages — the newsletter, the search index and the announcement —
name theirs b and pass "autoSubmit", "b" to compensate. They work, but only
because every one of them remembers to repeat the argument.

This renames those three to cont and drops the redundant arguments, so all four
agree with the default.

It is worth doing deliberately rather than leaving alone, because the theme branch
renames all three buttons and leaves the "b" argument in place. I measured what
that combination does:

markup call countdown field after doAutoSubmit(3, 'Continue')
name="cont" defaults (this PR) Continue (3)
name="cont" "autoSubmit", "b" (the branch) Continue — countdown lost
name="b" "autoSubmit", "b" (today) Continue (3)

The middle row takes the console.warn('Field "b" not found…') path. The form still
submits when the count runs out, so nothing breaks loudly; the countdown just stops
appearing.

The maintenance template had already drifted the other way

MaintenanceTemplate.php calls it with no arguments at all:

setTimeout("doAutoSubmit();", 1000);

so it looks for a form named autoSubmit. There isn't one. The installer and the
upgrader name their form from Maintenance::$tool->form_id, which is install_form
or upgrade_form — I checked the served page, and <form id="install_form" …> is
the only form on it. doAutoSubmit() hits console.error('Form with name "autoSubmit" not found.') and returns, so the step that should continue by itself
once its substeps finish just waits for the user to click Continue.

It now names the form it is actually on. Also passes a function to setTimeout()
rather than a string for it to eval.

Testing

The table above is real output: doAutoSubmit() run against each markup/call
combination in the browser on this build.

For the maintenance template, the fix is against the rendered installer — its only
form is install_form, so the old lookup could never have matched. I have not
driven a full install or upgrade to watch the countdown; the substep loop it sits
in needs one, and this is the kind of change where saying what was and was not
exercised seems more useful than implying otherwise.

Issues References (Fixes|Related|Closes)

Related to #7933

doAutoSubmit() looks the countdown field up by name, defaulting to 'cont', which
is what template_not_done() calls its button. Three other pages call their button
'b' and pass 'b' along to match: the newsletter progress page, the search index
progress page and the announcement progress page. They work, but only because
every one of them repeats the argument.

Renames those three buttons to 'cont' and drops the now redundant arguments, so
all four agree with the default. Worth doing deliberately: the theme branch in
7933 renames all three buttons and leaves the 'b' argument behind, at which point
the countdown silently stops appearing.

The maintenance template's call had already drifted the other way. It passes no
arguments at all, so it goes looking for a form named 'autoSubmit'; the installer
and the upgrader name their form 'install_form' and 'upgrade_form', so the lookup
fails, doAutoSubmit() logs and returns, and the step that should continue on its
own waits for a click instead. It now names the form it is actually on, and does
it with a function rather than a string for setTimeout() to eval.

Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
@albertlast albertlast mentioned this pull request Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant