add proper pattern validation

This commit is contained in:
Víctor Losada Hernández
2026-10-30 00:30:44 +01:00
parent 89667f38b5
commit f5056049eb
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ const Combobox = ({
suggestMethod : 'includes', suggestMethod : 'includes',
filterOn : [] // should allow as array to filter on multiple attributes, or even custom filter filterOn : [] // should allow as array to filter on multiple attributes, or even custom filter
}, },
valuePatterns = /.+/, valuePatterns = '.+',
options = [], options = [],
keepValueOnClose = false, keepValueOnClose = false,
...props ...props
@@ -264,6 +264,7 @@ const MetadataEditor = ({
defaultValue={metadata.lang || ''} defaultValue={metadata.lang || ''}
keepValueOnClose={true} keepValueOnClose={true}
placeholder='en' placeholder='en'
valuePatterns="^[a-z]{2,3}(-[A-Z][a-z]{3})?(-[A-Z]{2})?$"
onSelect={(value)=>handleLanguage(value)} onSelect={(value)=>handleLanguage(value)}
onEntry={(e)=>{ onEntry={(e)=>{
e.target.setCustomValidity(''); //Clear the validation popup while typing e.target.setCustomValidity(''); //Clear the validation popup while typing