From d79569429d0813e983de875da084b1ed007b6b51 Mon Sep 17 00:00:00 2001 From: Amanpal Singh <87360222+aman-alfresco@users.noreply.github.com> Date: Thu, 9 May 2024 13:05:13 +0530 Subject: [PATCH] fixed disable isue (#343) --- .../alfresco/content/process/ui/fragments/FormViewModel.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/process-app/src/main/kotlin/com/alfresco/content/process/ui/fragments/FormViewModel.kt b/process-app/src/main/kotlin/com/alfresco/content/process/ui/fragments/FormViewModel.kt index 95630372..65689678 100644 --- a/process-app/src/main/kotlin/com/alfresco/content/process/ui/fragments/FormViewModel.kt +++ b/process-app/src/main/kotlin/com/alfresco/content/process/ui/fragments/FormViewModel.kt @@ -543,8 +543,9 @@ class FormViewModel( private fun hasFieldValidData(fields: List): Boolean { val hasValidDataInRequiredFields = !fields.filter { it.required }.any { (it.value == null || it.errorData.first) } - val hasValidDataInDropDownRequiredFields = fields.filter { it.required && it.options.isNotEmpty() } - .any { field -> (field.options.find { option -> option.name == field.value }?.id != "empty") } + val hasValidDataInDropDownRequiredFields = fields.filter { it.required && it.options.isNotEmpty() }.let { list -> + list.isEmpty() || list.any { field -> field.options.any { option -> option.name == field.value && option.id != "empty" } } + } val hasValidDataInOtherFields = !fields.filter { !it.required }.any { it.errorData.first } return (hasValidDataInRequiredFields && hasValidDataInOtherFields && hasValidDataInDropDownRequiredFields) }