Merge branch 'feature/form_changes' into 'develop'

fixes

See merge request BPHV_MIPS/mvm_core_ui!168
This commit is contained in:
Pan, Xinlei (Ryan) 2019-11-08 16:26:25 -05:00
commit 2cf5d096e8
4 changed files with 9 additions and 3 deletions

View File

@ -669,7 +669,7 @@
- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData { - (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData {
self.validationRequired = [json boolForKey:@"validationRequired"]; self.validationRequired = [json boolForKey:@"required"];
self.requiredGroupsList = [json array:@"requiredGroups"]; self.requiredGroupsList = [json array:@"requiredGroups"];
[FormValidator setupValidationWithMolecule:self delegate:delegateObject.formValidationProtocol]; [FormValidator setupValidationWithMolecule:self delegate:delegateObject.formValidationProtocol];

View File

@ -19,6 +19,7 @@ import MVMCore
// Form Validation // Form Validation
var isRequired = false var isRequired = false
var fieldKey: String? var fieldKey: String?
var fieldValue: String?
var groupName: String? var groupName: String?
var delegateObject: MVMCoreUIDelegateObject? var delegateObject: MVMCoreUIDelegateObject?
@ -407,6 +408,7 @@ import MVMCore
guard let dictionary = json else { return } guard let dictionary = json else { return }
groupName = dictionary.optionalStringForKey("groupName") groupName = dictionary.optionalStringForKey("groupName")
fieldValue = dictionary.optionalStringForKey("value")
if let fieldKey = dictionary[KeyFieldKey] as? String { if let fieldKey = dictionary[KeyFieldKey] as? String {
self.fieldKey = fieldKey self.fieldKey = fieldKey
} }
@ -475,6 +477,6 @@ extension Checkbox: FormValidationFormFieldProtocol {
} }
public func formFieldValue() -> Any? { public func formFieldValue() -> Any? {
return NSNumber(value: isSelected) return isSelected ? fieldValue : nil
} }
} }

View File

@ -423,6 +423,10 @@ const CGFloat SwitchShakeIntensity = 2;
return UIAccessibilityTraitButton; return UIAccessibilityTraitButton;
} }
- (NSString * _Nullable)formFieldGroupName {
return [self.json string:@"groupName"];
}
- (NSString *)accessibilityHint { - (NSString *)accessibilityHint {
return [MVMCoreUIUtility hardcodedStringWithKey:@"AccToggleHint"]; return [MVMCoreUIUtility hardcodedStringWithKey:@"AccToggleHint"];
} }

View File

@ -39,7 +39,7 @@
@"textField" : MFTextField.class, @"textField" : MFTextField.class,
@"digitTextField" : MFDigitTextField.class, @"digitTextField" : MFDigitTextField.class,
@"checkbox" : Checkbox.class, @"checkbox" : Checkbox.class,
@"checkboxWithLabelView" : CheckboxWithLabelView.class, @"checkboxWithLabel" : CheckboxWithLabelView.class,
@"cornerLabels" : CornerLabels.class, @"cornerLabels" : CornerLabels.class,
@"progressbar": ProgressBar.class, @"progressbar": ProgressBar.class,
@"circleProgress": GraphView.class, @"circleProgress": GraphView.class,