diff --git a/form/src/main/java/org/dhis2/form/data/RulesUtilsProviderImpl.kt b/form/src/main/java/org/dhis2/form/data/RulesUtilsProviderImpl.kt index 238325287c..7711fe459a 100644 --- a/form/src/main/java/org/dhis2/form/data/RulesUtilsProviderImpl.kt +++ b/form/src/main/java/org/dhis2/form/data/RulesUtilsProviderImpl.kt @@ -385,6 +385,9 @@ class RulesUtilsProviderImpl( val message = warningOnCompletion.content() + " " + data if (model != null) { fieldViewModels[fieldUid] = model.setWarning(message) + fieldsWithWarnings.add( + FieldWithError(fieldUid, message), + ) } messageOnComplete = message diff --git a/form/src/test/java/org/dhis2/form/data/RulesUtilsProviderImplTest.kt b/form/src/test/java/org/dhis2/form/data/RulesUtilsProviderImplTest.kt index 1a8064ebeb..e87fa45c87 100644 --- a/form/src/test/java/org/dhis2/form/data/RulesUtilsProviderImplTest.kt +++ b/form/src/test/java/org/dhis2/form/data/RulesUtilsProviderImplTest.kt @@ -593,6 +593,7 @@ class RulesUtilsProviderImplTest { assertEquals(testFieldViewModels[testingUid]!!.warning, "content data") assertTrue(result.messageOnComplete == "content data") + assertTrue(result.fieldsWithWarnings.isNotEmpty()) assertTrue(result.canComplete) }