fixed issue with showing errorIcon without error message
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
d943202e83
commit
46d4098cf2
@ -453,27 +453,34 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open func updateErrorLabel(){
|
open func updateErrorLabel(){
|
||||||
if showError, let errorText {
|
|
||||||
errorLabel.text = errorText
|
/// always show the errorIcon if there is an error
|
||||||
errorLabel.surface = surface
|
if showError || hasInternalError {
|
||||||
errorLabel.isEnabled = isEnabled
|
|
||||||
errorLabel.isHidden = false
|
|
||||||
statusIcon.name = .error
|
|
||||||
statusIcon.surface = surface
|
|
||||||
statusIcon.isHidden = !isEnabled || state.contains(.focused)
|
|
||||||
} else if hasInternalError, let internalErrorText {
|
|
||||||
errorLabel.text = internalErrorText
|
|
||||||
errorLabel.surface = surface
|
|
||||||
errorLabel.isEnabled = isEnabled
|
|
||||||
errorLabel.isHidden = false
|
|
||||||
statusIcon.name = .error
|
statusIcon.name = .error
|
||||||
statusIcon.surface = surface
|
statusIcon.surface = surface
|
||||||
statusIcon.isHidden = !isEnabled || state.contains(.focused)
|
statusIcon.isHidden = !isEnabled || state.contains(.focused)
|
||||||
} else {
|
} else {
|
||||||
statusIcon.isHidden = true
|
statusIcon.isHidden = true
|
||||||
errorLabel.isHidden = true
|
|
||||||
}
|
}
|
||||||
statusIcon.color = iconColorConfiguration.getColor(self)
|
statusIcon.color = iconColorConfiguration.getColor(self)
|
||||||
|
|
||||||
|
// only show errorLabel if there is a message
|
||||||
|
var message: String?
|
||||||
|
if showError, let errorText {
|
||||||
|
message = errorText
|
||||||
|
} else if hasInternalError, let internalErrorText {
|
||||||
|
message = internalErrorText
|
||||||
|
}
|
||||||
|
|
||||||
|
if let message {
|
||||||
|
errorLabel.text = message
|
||||||
|
errorLabel.surface = surface
|
||||||
|
errorLabel.isEnabled = isEnabled
|
||||||
|
errorLabel.isHidden = false
|
||||||
|
} else {
|
||||||
|
errorLabel.isHidden = true
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open func updateHelperLabel(){
|
open func updateHelperLabel(){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user