mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-15 14:52:39 +00:00
tweak validation rules on Thumbnail & prevent invalid field from block valid fields
This commit is contained in:
@@ -65,7 +65,7 @@ const MetadataEditor = createClass({
|
|||||||
[name] : validationErr.length > 0 ? validationErr : undefined
|
[name] : validationErr.length > 0 ? validationErr : undefined
|
||||||
}
|
}
|
||||||
}), ()=>{
|
}), ()=>{
|
||||||
if(Object.values(this.state.errs ?? {}).filter(Boolean).length === 0 || !this.state.errs[name]){
|
if(validationErr.length === 0){
|
||||||
e.target.setCustomValidity('');
|
e.target.setCustomValidity('');
|
||||||
this.props.onChange({
|
this.props.onChange({
|
||||||
...this.props.metadata,
|
...this.props.metadata,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ module.exports = {
|
|||||||
return value?.length > 256 ? 'Max URL length of 256 characters.' : null;
|
return value?.length > 256 ? 'Max URL length of 256 characters.' : null;
|
||||||
},
|
},
|
||||||
(value)=>{
|
(value)=>{
|
||||||
|
if(value?.length == 0){return null;}
|
||||||
try {
|
try {
|
||||||
Boolean(new URL(value));
|
Boolean(new URL(value));
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user