changes
This commit is contained in:
parent
5c0e433193
commit
c8d628da31
@ -320,7 +320,11 @@ import UIKit
|
||||
model.updateUIDynamicError = { [weak self] in
|
||||
MVMCoreDispatchUtility.performBlock(onMainThread: {
|
||||
guard let self = self else { return }
|
||||
self.updateValidation(model.isValid ?? false)
|
||||
let validState = model.isValid ?? false
|
||||
self.updateValidation(validState)
|
||||
if !validState && model.shouldClearText {
|
||||
self.text = ""
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@ import Foundation
|
||||
public var accessibilityIdentifier: String?
|
||||
public var title: String?
|
||||
public var feedback: String?
|
||||
public var shouldClearText: Bool = false
|
||||
public var dynamicErrorMessage: String? {
|
||||
didSet {
|
||||
isValid = dynamicErrorMessage?.isEmpty ?? true
|
||||
|
||||
@ -449,10 +449,7 @@ import UIKit
|
||||
let entryFieldModel = formValidator?.fields[fieldName] as? EntryFieldModel
|
||||
else { continue }
|
||||
|
||||
if fieldError["clearText"] as? Bool ?? true {
|
||||
entryFieldModel.text = ""
|
||||
}
|
||||
|
||||
entryFieldModel.shouldClearText = fieldError["clearText"] as? Bool ?? true
|
||||
entryFieldModel.dynamicErrorMessage = userError
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user