diff --git a/VDS/Components/TextFields/EntryFieldBase.swift b/VDS/Components/TextFields/EntryFieldBase.swift index 6964ae0a..ae91cc7a 100644 --- a/VDS/Components/TextFields/EntryFieldBase.swift +++ b/VDS/Components/TextFields/EntryFieldBase.swift @@ -154,13 +154,13 @@ open class EntryFieldBase: Control, Changeable, FormFieldable { open var showError: Bool = false { didSet { setNeedsUpdate() } } /// Whether or not to show the internal error - internal var showInternalError: Bool = false { didSet { setNeedsUpdate() } } + open internal(set) var hasInternalError: Bool = false { didSet { setNeedsUpdate() } } /// Override UIControl state to add the .error state if showError is true. open override var state: UIControl.State { get { var state = super.state - if showError || showInternalError { + if showError || hasInternalError { state.insert(.error) } return state @@ -380,7 +380,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldable { } open func updateErrorLabel(){ - if showError, showInternalError, let errorText, let internalErrorText { + if showError, hasInternalError, let errorText, let internalErrorText { errorLabel.text = [internalErrorText, errorText].joined(separator: "\n") errorLabel.surface = surface errorLabel.isEnabled = isEnabled @@ -398,7 +398,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldable { icon.color = VDSColor.paletteBlack icon.surface = surface icon.isHidden = !isEnabled - } else if showInternalError, let internalErrorText { + } else if hasInternalError, let internalErrorText { errorLabel.text = internalErrorText errorLabel.surface = surface errorLabel.isEnabled = isEnabled diff --git a/VDS/Components/TextFields/TextArea/TextArea.swift b/VDS/Components/TextFields/TextArea/TextArea.swift index 317748e4..d30c187f 100644 --- a/VDS/Components/TextFields/TextArea/TextArea.swift +++ b/VDS/Components/TextFields/TextArea/TextArea.swift @@ -247,16 +247,16 @@ open class TextArea: EntryFieldBase { let countStr = (count > maxLength ?? 0) ? ("-" + "\(count-(maxLength ?? 0))") : "\(count)" if let maxLength, maxLength > 0 { if count > maxLength { - showInternalError = true + hasInternalError = true internalErrorText = "You have exceeded the character limit." return countStr } else { - showInternalError = false + hasInternalError = false internalErrorText = nil return ("\(countStr)" + "/" + "\(maxLength)") } } else { - showInternalError = false + hasInternalError = false internalErrorText = nil return nil }