radio field validation on options

This commit is contained in:
Dan Ribbens
2020-08-23 16:49:51 -04:00
parent 756d275edf
commit 8bfc892f7c
2 changed files with 3 additions and 3 deletions

View File

@@ -31,9 +31,9 @@ const RadioGroup = (props) => {
const path = pathFromProps || name;
const memoizedValidate = useCallback((value) => {
const validationResult = validate(value, { required });
const validationResult = validate(value, { required, options });
return validationResult;
}, [validate, required]);
}, [validate, required, options]);
const {
value,

View File

@@ -157,7 +157,7 @@ const optionsToValidatorMap = {
return defaultMessage;
},
radio: (value, options = {}) => {
if (value || !options.required) return true;
if ((value || !options.required) && (options.options.find((option) => option.value === value))) return true;
return defaultMessage;
},
blocks: (value, options) => {