[3.0] Theme split (wave 4, part 34) — let the field say what it is - #9487
Merged
live627 merged 2 commits intoAug 10, 2026
Merged
Conversation
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>
Closed
…ster-autov Signed-off-by: albertlast <mathiaspapealbert@hotmail.com> # Conflicts: # Themes/default/scripts/register.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Part of the #7933 split (wave 4, part 34). Login / Register / Reminder area.
register.jsdecided what each field was by reading itsidand looking forsubstrings in it:
So a field had to be called
smf_autov_pwmain, and for it to get an icon thetemplate had to write out two nested spans called
smf_autov_pwmain_divandsmf_autov_pwmain_img, the outer one hidden until the script unhid it. Nothingoutside 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 isused. That takes twelve lines of markup out of
Register.template.phpandReminder.template.php, and the id-sniffing out of the script. The ids left onthe register fields are now only what the
<label for>needs, which is what anid is for.
Rendering is unchanged. The same
main_icons check/valid/invalidspans, in the same place, with the same
title; the inputs still takevalid_inputandinvalid_input; the username icon is still the link that asksthe 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:
blurhandler that asks whether a username is taken was attached toevery verified field, so typing in a password box fired a username lookup.
It belongs to the username field.
refreshMainPassword()took acalled_from_verifyflag whose only purpose wasto stop it and
refreshVerifyPassword()calling each other forever. The ruleis 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 cameback. Previously
XMLDoc.getElementsByTagName("username")was tested fortruthiness — an empty
HTMLCollectionis 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 theicon 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 themarkup, 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