diff --git a/MVMCoreUI/Atoms/Buttons/PrimaryButton.m b/MVMCoreUI/Atoms/Buttons/PrimaryButton.m index 35395557..3b1802e5 100644 --- a/MVMCoreUI/Atoms/Buttons/PrimaryButton.m +++ b/MVMCoreUI/Atoms/Buttons/PrimaryButton.m @@ -669,7 +669,7 @@ - (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"]; [FormValidator setupValidationWithMolecule:self delegate:delegateObject.formValidationProtocol]; diff --git a/MVMCoreUI/Atoms/Views/Checkbox.swift b/MVMCoreUI/Atoms/Views/Checkbox.swift index e5a82b1d..370f5826 100644 --- a/MVMCoreUI/Atoms/Views/Checkbox.swift +++ b/MVMCoreUI/Atoms/Views/Checkbox.swift @@ -19,6 +19,7 @@ import MVMCore // Form Validation var isRequired = false var fieldKey: String? + var fieldValue: String? var groupName: String? var delegateObject: MVMCoreUIDelegateObject? @@ -407,6 +408,7 @@ import MVMCore guard let dictionary = json else { return } groupName = dictionary.optionalStringForKey("groupName") + fieldValue = dictionary.optionalStringForKey("value") if let fieldKey = dictionary[KeyFieldKey] as? String { self.fieldKey = fieldKey } @@ -475,6 +477,6 @@ extension Checkbox: FormValidationFormFieldProtocol { } public func formFieldValue() -> Any? { - return NSNumber(value: isSelected) + return isSelected ? fieldValue : nil } } diff --git a/MVMCoreUI/Atoms/Views/MVMCoreUISwitch.m b/MVMCoreUI/Atoms/Views/MVMCoreUISwitch.m index ae0db4a7..8ec71241 100644 --- a/MVMCoreUI/Atoms/Views/MVMCoreUISwitch.m +++ b/MVMCoreUI/Atoms/Views/MVMCoreUISwitch.m @@ -423,6 +423,10 @@ const CGFloat SwitchShakeIntensity = 2; return UIAccessibilityTraitButton; } +- (NSString * _Nullable)formFieldGroupName { + return [self.json string:@"groupName"]; +} + - (NSString *)accessibilityHint { return [MVMCoreUIUtility hardcodedStringWithKey:@"AccToggleHint"]; } diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m index 8b3f098c..5298b10c 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m +++ b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m @@ -39,7 +39,7 @@ @"textField" : MFTextField.class, @"digitTextField" : MFDigitTextField.class, @"checkbox" : Checkbox.class, - @"checkboxWithLabelView" : CheckboxWithLabelView.class, + @"checkboxWithLabel" : CheckboxWithLabelView.class, @"cornerLabels" : CornerLabels.class, @"progressbar": ProgressBar.class, @"circleProgress": GraphView.class,