mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-04 22:38:43 +00:00
add proper pattern validation
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user