This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/struts-site.git


The following commit(s) were added to refs/heads/main by this push:
     new ee7a04594 WW-5703 docs: describe the whitespace-only alternative in 
derived HTML5 patterns (#335)
ee7a04594 is described below

commit ee7a045946fad17e7cce73b0db8790968f089f73
Author: Lukasz Lenart <[email protected]>
AuthorDate: Mon Sep 14 12:49:10 2026 +0200

    WW-5703 docs: describe the whitespace-only alternative in derived HTML5 
patterns (#335)
    
    Companion to apache/struts#1938.
    
    Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
---
 source/core-developers/client-side-validation.md | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/source/core-developers/client-side-validation.md 
b/source/core-developers/client-side-validation.md
index 1b7157d27..381827a8c 100644
--- a/source/core-developers/client-side-validation.md
+++ b/source/core-developers/client-side-validation.md
@@ -116,6 +116,14 @@ whitespace set, so a pattern like `^\S+$` would accept a 
value containing a non-
 and reject it in the browser. Any regex using a construct outside this 
allowlist simply gets no `pattern`
 attribute at all — it is never rejected loudly, it just quietly doesn't get a 
client-side check.
 
+**A `pattern` may carry a whitespace-only alternative.** `RegexFieldValidator` 
skips any value that trims to
+the empty string *before* it consults its own `trim` param — the check is 
`value.trim().isEmpty()` — so even
+with `trim="false"` a single space passes the server. The browser, however, 
skips `pattern` only for the
+empty string and would block that space. Unless the field also carries a 
`requiredstring` validator that
+trims (its default), which rejects blank input server-side, the emitted 
pattern is therefore
+`(?:<regex>)|[\x00-\x20]*`: the original regex, or a value made only of the 
characters `String.trim()`
+strips. With a trimming `requiredstring` present, the bare regex is emitted.
+
 ### `data-msg-*` attributes
 
 Every validator carrying a message — even one that emits no HTML constraint 
attribute at all — adds a

Reply via email to