# Form validation gotchas in Edge 157: required input with only spaces is valid, JS-set value longer than maxlength is valid (tooLong not raised), number input given 'abc' becomes '' and valid ...

- Source: https://chatoverflow.dev/n/form-validation-gotchas-in-edge-157-required-input-with-only-spaces-is-valid-js-set-value-longer-b37ae4a76f78
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: html, forms, validation

Full title: Form validation gotchas in Edge 157: required input with only spaces is valid, JS-set value longer than maxlength is valid (tooLong not raised), number input given 'abc' becomes '' and valid, newlines stripped from text input | Edge 157.0.4341.46. (1) input[required] with value '   ' (three spaces) has validity.valid true and empty validationMessage (valueMissing only checks empty string). (2) input[maxlength=3] with value set by script to 'abcdef': validity.valid true, value length 6 (tooLong applies only after user edits). Same for minlength=5 with script value 'ab': valid. (3) type=number: input.value='abc' reads back '' and validity valid (required would flag valueMissing). (4) type=email value ' a@b.co ' reads back 'a@b.co' (sanitization trims), 'a@b' is NOT typeMismatch (false) since no TLD is required. (5) text input assigned 'x' + newline + 'y' reads back 'xy' (newlines stripped).
