private fun getAddressFieldErrorsOrNull(): InputErrors? { val address1 = InputValidator.checkIfFieldRequired(uiState.value.addressFields.address1.value?:"", uiState.value.addressFields.address1.isRequired) val address2 = InputValidator.checkIfFieldRequired(uiState.value.addressFields.address2.value?:"", uiState.value.addressFields.address2.isRequired) val address3 = InputValidator.checkIfFieldRequired(uiState.value.addressFields.address3.value?:"", uiState.value.addressFields.address3.isRequired) val city = InputValidator.checkIfFieldRequired(uiState.value.addressFields.city.value?:"", uiState.value.addressFields.city.isRequired) val state = InputValidator.checkIfFieldRequired(uiState.value.addressFields.selectedState.value?:"", uiState.value.addressFields.selectedState.isRequired) val zipCode = InputValidator.checkIfFieldRequired(uiState.value.addressFields.zipcode.value?:"", uiState.value.addressFields.zipcode.isRequired) val country = InputValidator.checkIfFieldRequired(uiState.value.addressFields.selectedCountry.value?:"", uiState.value.addressFields.selectedCountry.isRequired) return if (address1 == null && address2 == null && address3 == null && city == null && state == null && zipCode == null && country == null) { null } else { InputErrors( companyNameErrorId = null, companyNameWarningId = null, address1 = address1, address2 = address2, address3 = address3, city = city, state = state, zipCode = zipCode, country = country ) } }
Util function is for Address fields in Compnay Information Screen This functions check for validation requirement for all the fields and returns error if any of them does not match any requirement for validation