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