diff --git a/datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/EditTextDecimalViewHolderFactory.kt b/datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/EditTextDecimalViewHolderFactory.kt index 7f0ef4a7d8..1f16ab7cd0 100644 --- a/datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/EditTextDecimalViewHolderFactory.kt +++ b/datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/EditTextDecimalViewHolderFactory.kt @@ -76,8 +76,14 @@ internal object EditTextDecimalViewHolderFactory : ) // Update error message if draft answer present if (questionnaireViewItem.draftAnswer != null) { + val minValue = questionnaireViewItem.minAnswerValue?.toString() ?: DecimalType(Int.MIN_VALUE).toString() + val maxValue = questionnaireViewItem.maxAnswerValue?.toString() ?: DecimalType(Int.MAX_VALUE).toString() textInputLayout.error = - textInputLayout.context.getString(R.string.decimal_format_validation_error_msg) + textInputLayout.context.getString( + R.string.decimal_format_validation_error_msg, + minValue, + maxValue + ) } } } diff --git a/datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/EditTextIntegerViewHolderFactory.kt b/datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/EditTextIntegerViewHolderFactory.kt index f619802494..5bd42ccef2 100644 --- a/datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/EditTextIntegerViewHolderFactory.kt +++ b/datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/EditTextIntegerViewHolderFactory.kt @@ -92,11 +92,13 @@ internal object EditTextIntegerViewHolderFactory : ) // Update error message if draft answer present if (questionnaireViewItem.draftAnswer != null) { + val minValue = questionnaireViewItem.minAnswerValue?.toString() ?: IntegerType(Int.MIN_VALUE).toString() + val maxValue = questionnaireViewItem.maxAnswerValue?.toString() ?: IntegerType(Int.MAX_VALUE).toString() textInputLayout.error = textInputLayout.context.getString( R.string.integer_format_validation_error_msg, - formatInteger(Int.MIN_VALUE), - formatInteger(Int.MAX_VALUE), + minValue, + maxValue ) } }