I am stumped as to why updateValidityIndication() works in one case and not in another. In the following code snippets, I am setting the validity.valid and updateValidityIndication() based upon whether a flag is false. The first piece of code has been working unchanged for several months. The second piece was added today. Both fields are TextInput fields, and both have identical settings, including not having Required checked.
The first piece of code -- for $w('#lastname') -- works as expected: validity.valid gets set to false, the field is highlighted in red (default error design), and the error message appears.
In the second pieces of code -- for $w('#address1') -- things get weird: validity.valid gets set to false, the field is NOT highlighted in red, and the error message appears.
Because the error messages appear, I know that the code is executing.
The only difference between the two fields is that $w('#lastname') has a onCustomValidation event, and $w('#address1') does not. Given that I am explicitly setting the validity and indication, this difference should be irrelevant.
So... any thoughts out there? Is there something under the covers with onCustomValidation that affects the way the API works for these statements? Any insight appreciated.
if (!lastnameValid) {
$w('#lastname').validity.valid = false;
$w('#lastname').updateValidityIndication();
$w('#lastnameErr').show();
}
if (!address1Valid) {
$w('#address1').validity.valid = false;
$w('#address1').updateValidityIndication();
$w('#entireAddressErr').show();
}
Check this out: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation
Yes I am seeing this inconsistent behaviour too. I have a text input field with type set to 'number' and a regular expression for validation :
^[0-9]*$ // whole numbers only
When, for example, the string 23.34 is entered, as expected it fails the validation, but the field is not highlighted in red even though I call
fieldId.updateValidityIndication()
And the fieldId.vaidationMessage is 'step mismatch'
What does that mean??