diff --git a/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1.storyboard b/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1.storyboard index 7d0e46d8..e4c82262 100644 --- a/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1.storyboard +++ b/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1.storyboard @@ -496,6 +496,7 @@ + diff --git a/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1ViewController.swift b/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1ViewController.swift index 3b323569..c89a4c85 100644 --- a/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1ViewController.swift +++ b/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1ViewController.swift @@ -56,6 +56,7 @@ class KycForm1ViewController: UIViewController { // MARK: IBOutlets + @IBOutlet weak var scrollView: UIScrollView! // validation labels @IBOutlet weak var firstNameErrorLabel: UILabel! @IBOutlet weak var middleNameErrorLabel: UILabel! @@ -207,7 +208,19 @@ class KycForm1ViewController: UIViewController { private func setupErrorTextFields() { self.textfields = [firstNameTextField, lastNameTextField, middleNmaeTextField, genderTextField, dobTextField, mobileNumberTextField, emailTextField, nativeCountryTextField, countryTextField, provinceTextField, occupationTextField] - + firstNameTextField.tag = 1 + middleNmaeTextField.tag = 2 + lastNameTextField.tag = 3 + genderTextField.tag = 4 + dobTextField.tag = 5 + mobileNumberTextField.tag = 6 + emailTextField.tag = 7 + nativeCountryTextField.tag = 8 + countryTextField.tag = 9 + provinceTextField.tag = 10 + occupationTextField.tag = 11 + + self.errorTextFieldDict = [ KycForm1FieldKeys.firstName: self.firstNameTextField, @@ -232,6 +245,7 @@ class KycForm1ViewController: UIViewController { } private func show( error: String, label: UILabel?) { + // scroll to the top of the view guard let label = label else {return} label.textColor = Constants.stateRedColor label.isHidden = false @@ -242,6 +256,7 @@ class KycForm1ViewController: UIViewController { // MARK: KycForm1ViewInterface extension KycForm1ViewController: KycForm1ViewInterface { func show(result: (doesNotSucks: Bool, errorsDick: [String : String])) { + var position = 11 if result.doesNotSucks { // if isValid // its is not valid, lets go to security page self.delegate?._continue(model: self.kycModel) @@ -251,6 +266,15 @@ extension KycForm1ViewController: KycForm1ViewInterface { self.show(error: $0.value, label: label) let textfield = errorTextFieldDict[$0.key] self.showBorder(textfield: textfield) + let tag = (textfield?.tag ?? 11) + position = tag < position ? tag : position + if let topMostTextField = self.textfields.filter({ + $0.tag == tag + }).first { + + // scroll to view here + + } }) } @@ -397,4 +421,3 @@ extension KycForm1ViewController { self.selectedOccupation = _occupation } } -