From f48fac5c77be74da6d1175badbb84983e71b221c Mon Sep 17 00:00:00 2001 From: Abhishek P Anil Date: Mon, 30 Sep 2024 11:21:51 +0530 Subject: [PATCH] fix: fieldName passed dynamically --- src/constants/formFields.js | 4 ++-- .../Dashboard/CreateNewOrganization/CreateNewOrganization.jsx | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/constants/formFields.js b/src/constants/formFields.js index 92120cd5..65452d47 100644 --- a/src/constants/formFields.js +++ b/src/constants/formFields.js @@ -142,10 +142,10 @@ const rules = [ }, { dataType: dataTypes.IDENTITY_STRING, - rule: ({ t }) => [ + rule: ({ t, fieldName }) => [ ({ getFieldValue }) => ({ validator() { - if (getFieldValue('location')) return Promise.resolve(); + if (getFieldValue(fieldName)) return Promise.resolve(); else return Promise.reject(new Error(t('common.validations.informationRequired'))); }, }), diff --git a/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx b/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx index 89c64b79..4dae9f4d 100644 --- a/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx +++ b/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx @@ -285,9 +285,6 @@ function CreateNewOrganization() { validateFieldList = validateFieldList?.concat( formFieldProperties?.mandatoryFields?.dynamicFields?.map((field) => ['dynamicFields', field]), ); - console.log(form.getFieldsError(['location'])); - console.log(form.getFieldInstance('location')); - console.log(form.getFieldError('location')); var promise = new Promise(function (resolve, reject) { form