Skip to content

Commit

Permalink
fixed disable isue (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-alfresco authored May 9, 2024
1 parent 4a7d103 commit d795694
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,9 @@ class FormViewModel(

private fun hasFieldValidData(fields: List<FieldsData>): 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)
}
Expand Down

0 comments on commit d795694

Please sign in to comment.