Skip to content

Add missing status reset on cleared inputs and optimize and adapt name validation logic#46

Open
SJHWU wants to merge 3 commits intoEndereco:masterfrom
SJHWU:fix/bugs-DEV-343
Open

Add missing status reset on cleared inputs and optimize and adapt name validation logic#46
SJHWU wants to merge 3 commits intoEndereco:masterfrom
SJHWU:fix/bugs-DEV-343

Conversation

@SJHWU
Copy link
Contributor

@SJHWU SJHWU commented Feb 26, 2026

Add status reset on cleared input in Phone, Title and Name Extensions

On clearing the title,phone, firstName or lastName field, the validation status was
not reset . This could result in empty fields showing a validation status.
This commit adds status reset, when the value in the respective input fields
is changed to an empty string. Title-, phone- and name fields now behave consistently
with the email- and addressfields.

Ref: DEV-343/bugs 1 and 6

Optimize and adapt name validation logic

The name validation logic in NameCheckExtension.js had a few issues;

DEV-343/2: When the first request returned "name_not_found", for example
when there was a typo in the name, on the second request with API answer
"name_needs_correction" the field status for firstName and lastName was not
set. The reason was, that firstNameStatus and lastNameStatus where only
set on the request with index 1.
This commit replaces the request index in the respective if-clause with a persistent
boolean flag nameCorrected. This ensures, that firstNameStatus and lastNameStatus
will be set on the first request that returns "name_needs_correction" and, as it
was before, on every request that returns "name_correct".

DEV-343/3: On requests with response "salutation x", the salutation field status
was set to "salutation_correct". This resulted in salutation fields with value
"Bitte wählen" or "keine Angabe" showing green validation colors.
With this commit, after requests that return "salutation x" , the salutation field
is set to an empty status.

DEV-343/4: Until now, the salutation field was automatically set for an unlimited
number of requests. This prevented users from selecting a neutral option (salutation x),
which is no longer in line with modern standards as it forces a gender disclosure.
In this commit, the code block that automatically sets the salutation field is moved
inside the clause controlled by the new nameCorrected flag. This ensures, that the
salutation will only be automatically set on time max.

DEV-343/5: On requests with empty firstName or empty lastName, for example
"Herr Müller" or "Herr Florian", the API returns "name_correct" and the status
of both input fields is set to "correct". This resulted in an empty input field, showing
green validation colors.
This commit introduces a ternary operator, that ensures, that only the status of
not-empty firstName or lastName fields will be set to "correct".

On clearing the title,phone, firstName or lastName  field, the validation status was
not reset . This could result in empty fields showing a validation status.
This commit adds status reset, when the value in the respective input fields
is changed to an empty string. Title-, phone- and name fields now behave consistently
with the email- and addressfields.

Ref: DEV-343/bugs 1 and 6
There was no salutation field with three options (m,f,x) in the example form
use-cases/example. The configuration for correcTranspositionedNames could
not be set in the example form itself,
To enable and simplify thorough testing, this commit adds  a third salutation
option (salutation x) to both salutation dropdowns, and integrates the configuration
for correctTranspositionedNames directly into the example form.
@SJHWU SJHWU changed the title Add missing status reset on cleared inputs and optimize and adapt validation logic Add missing status reset on cleared inputs and optimize and adapt name validation logic Feb 26, 2026
The name validation logic in NameCheckExtension.js had a few issues;

DEV-343/2: When the first request returned "name_not_found", for example
when there was a typo in the name, on the second request with API answer
"name_needs_correction" the field status for firstName and lastName was not
set. The reason was, that firstNameStatus and lastNameStatus where only
set on the request with index 1.
This commit replaces the request index in the respective if-clause with a persistent
boolean flag nameCorrected. This ensures, that firstNameStatus and lastNameStatus
will be set on the first request that returns "name_needs_correction" and, as it
was before, on every request that returns "name_correct".

DEV-343/3: On requests with response "salutation x", the salutation field status
was set to "salutation_correct". This resulted in salutation fields with value
"Bitte wählen" or "keine Angabe" showing green validation colors.
With this commit, after requests that return "salutation x" , the salutation field
is set to an empty status.

DEV-343/4: Until now, the salutation field was automatically set for an unlimited
number of requests.  This prevented users from selecting a neutral option (salutation x),
which is no longer in line with modern standards as it forces a gender disclosure.
In this commit, the code block that automatically sets the salutation field is moved
inside the clause controlled by the new nameCorrected flag. This ensures, that the
salutation will only be automatically set on time max.

DEV-343/5:  On requests with empty firstName or empty lastName, for example
"Herr Müller" or "Herr Florian", the API returns "name_correct" and the status
of both input fields is set to "correct". This resulted in an empty input field, showing
green validation colors.
This commit introduces a ternary operator, that ensures, that only the status of
not-empty firstName or lastName fields will be set to "correct".
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