diff --git a/src/pages/AddCompany/index.js b/src/pages/AddCompany/index.js index 87c712e..8e06d7d 100644 --- a/src/pages/AddCompany/index.js +++ b/src/pages/AddCompany/index.js @@ -36,7 +36,7 @@ const AddCompany = () => { formState: { errors }, setValue, watch, - getValues + trigger } = useForm({ defaultValues: {}, mode: 'onChange' @@ -131,6 +131,7 @@ const AddCompany = () => { } else { setEmptyValues(); } + trigger(); storeSet.main.unsetAsyncRequest(); } @@ -207,7 +208,12 @@ const AddCompany = () => { label={__('P.IVA', 'gepafin')} control={control} errors={errors} - config={{ required: __('È obbligatorio', 'gepafin') }} + config={{ + required: __('È obbligatorio', 'gepafin'), + validate: { + isPIVA + } + }} /> { const header = renderHeader(); const updateEvaluationValue = (value, path, maxValue) => { + const pathEls = path.split('.'); let finalValue = value; if (maxValue || maxValue === 0) { finalValue = value > maxValue ? maxValue : value; } - const newData = wrap(data).set(path.split('.'), finalValue).value(); + const newData = wrap(data).set(pathEls, finalValue).value(); setData(newData); } @@ -242,7 +243,7 @@ const DomandaEditPreInstructor = () => { case 'fileupload' : content = ; break; @@ -512,7 +513,9 @@ const DomandaEditPreInstructor = () => {
{o.fileDetail && o.fileDetail.length === 1 ?