Skip to content

[3.0] Theme split (wave 4, part 34) — let the field say what it is - #9487

Merged
live627 merged 2 commits into
SimpleMachines:release-3.0from
albertlast:3.0/theme-register-autov
Aug 10, 2026
Merged

[3.0] Theme split (wave 4, part 34) — let the field say what it is#9487
live627 merged 2 commits into
SimpleMachines:release-3.0from
albertlast:3.0/theme-register-autov

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

Description

Part of the #7933 split (wave 4, part 34). Login / Register / Reminder area.

register.js decided what each field was by reading its id and looking for
substrings in it:

if (curElement.id.indexOf('autov') != -1 && )
{
    if (curElement.id.indexOf('username') != -1 && window.XMLHttpRequest)
        curType = 'username';
    else if (curElement.id.indexOf('pwmain') != -1)
        

So a field had to be called smf_autov_pwmain, and for it to get an icon the
template had to write out two nested spans called smf_autov_pwmain_div and
smf_autov_pwmain_img, the outer one hidden until the script unhid it. Nothing
outside this file has ever addressed any of them.

What changes

The field says what it is, in data-autov, and the icon is built where it is
used. That takes twelve lines of markup out of Register.template.php and
Reminder.template.php, and the id-sniffing out of the script. The ids left on
the register fields are now only what the <label for> needs, which is what an
id is for.

Rendering is unchanged. The same main_icons check / valid / invalid
spans, in the same place, with the same title; the inputs still take
valid_input and invalid_input; the username icon is still the link that asks
the server on demand. The wrapper span that goes away was an unstyled inline
<span> once the script had unhidden it.

Two things fell out of the rewrite:

  • The blur handler that asks whether a username is taken was attached to
    every verified field, so typing in a password box fired a username lookup.
    It belongs to the username field.
  • refreshMainPassword() took a called_from_verify flag whose only purpose was
    to stop it and refreshVerifyPassword() calling each other forever. The rule
    is now a function both of them ask, so neither has to know about the other.

The callback also stops assuming there is a <username> element in whatever came
back. Previously XMLDoc.getElementsByTagName("username") was tested for
truthiness — an empty HTMLCollection is truthy — and then indexed at [0],
which throws whenever the response is not the XML it expected.

Testing

On the registration page, driving the real form: the three icons start as check /
invalid / invalid exactly as the old markup did; a short password, a good one, a
matching verify and a mismatched one each give the same icon, title and input
class as on release-3.0; typing a username resets it to check; clicking the
icon asks the server. On the reminder's set-password page the two password icons
behave the same and no username icon is built. No console errors.

The username lookup itself needs #9486 to get an answer at all and #9483 for that
answer to be valid="0" rather than an error page; this part is about the
markup, and was verified with both in the tree as well as without.

Depends on #9439, which removes the createEventListener() call from this file —
the same line this rewrite drops. Whichever lands first, the other conflicts on
that one line.

Issues References (Fixes|Related|Closes)

Related to #7933

register.js worked out what each field was by reading its id and looking for
substrings in it, so a field had to be called smf_autov_pwmain and the template
had to write out two nested spans called smf_autov_pwmain_div and
smf_autov_pwmain_img for it to draw an icon into. Nothing outside this file ever
addressed any of those.

The field now carries data-autov, and the icon is built where it is used. That
takes twelve lines of markup out of the two templates and the id-sniffing out of
the script, and leaves the ids free to be about the labels, which is what
Register's are now for.

Rendering is unchanged. The icons are the same main_icons check, valid and
invalid spans in the same place, the inputs still take valid_input and
invalid_input, and the username icon is still the link that asks the server.

Two things that fell out of it:

The blur handler that asks whether a username is taken was attached to every
verified field, so typing a password fired a username lookup. It is the
username's now.

refreshMainPassword() took a flag whose only purpose was to stop it and
refreshVerifyPassword() calling each other forever. The rule itself is now a
function both of them ask, so neither has to know about the other.

Part of the SimpleMachines#7933 split.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
@albertlast albertlast mentioned this pull request Aug 10, 2026
…ster-autov

Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>

# Conflicts:
#	Themes/default/scripts/register.js
@live627
live627 merged commit 06691d2 into SimpleMachines:release-3.0 Aug 10, 2026
4 checks passed
@jdarwood007 jdarwood007 added this to the 3.0 Alpha 5 milestone Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants