fixing form error message issue (#2047)
This commit is contained in:
parent
7ba10c1b7a
commit
2a51f0ee14
3 changed files with 4 additions and 4 deletions
|
@ -24,7 +24,7 @@ enum Filters {
|
||||||
|
|
||||||
const New: React.FC = () => {
|
const New: React.FC = () => {
|
||||||
const methods = useForm<TopicFormData>({
|
const methods = useForm<TopicFormData>({
|
||||||
mode: 'all',
|
mode: 'onChange',
|
||||||
resolver: yupResolver(topicFormValidationSchema),
|
resolver: yupResolver(topicFormValidationSchema),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ const CustomParamField: React.FC<Props> = ({
|
||||||
newExistingFields.push(nameValue);
|
newExistingFields.push(nameValue);
|
||||||
setExistingFields(newExistingFields);
|
setExistingFields(newExistingFields);
|
||||||
setValue(`customParams.${index}.value`, TOPIC_CUSTOM_PARAMS[nameValue], {
|
setValue(`customParams.${index}.value`, TOPIC_CUSTOM_PARAMS[nameValue], {
|
||||||
shouldValidate: true,
|
shouldValidate: !!TOPIC_CUSTOM_PARAMS[nameValue],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [existingFields, index, nameValue, setExistingFields, setValue]);
|
}, [existingFields, index, nameValue, setExistingFields, setValue]);
|
||||||
|
@ -92,7 +92,7 @@ const CustomParamField: React.FC<Props> = ({
|
||||||
</FormError>
|
</FormError>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<InputLabel>Value</InputLabel>
|
<InputLabel>Value *</InputLabel>
|
||||||
<Input
|
<Input
|
||||||
name={`customParams.${index}.value` as const}
|
name={`customParams.${index}.value` as const}
|
||||||
hookFormOptions={{
|
hookFormOptions={{
|
||||||
|
|
|
@ -61,7 +61,7 @@ export const topicFormValidationSchema = yup.object().shape({
|
||||||
maxMessageBytes: yup.number().min(1).required(),
|
maxMessageBytes: yup.number().min(1).required(),
|
||||||
customParams: yup.array().of(
|
customParams: yup.array().of(
|
||||||
yup.object().shape({
|
yup.object().shape({
|
||||||
name: yup.string().required(),
|
name: yup.string().required('Custom parameter is required'),
|
||||||
value: yup.string().required('Value is required'),
|
value: yup.string().required('Value is required'),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
|
Loading…
Add table
Reference in a new issue