SFormChoiceFieldValidators Class Reference

Inherits from NSObject
Declared in SFormChoiceFieldValidators.h
Availability
Related samples

Overview

A utility class that provides helper methods for some common choice field validator types.

Class Methods

compareWithChoiceField:validResult:

Returns a validator that compares the validating choice field’s input against a specified choice field’s input.

+ (SFormChoiceFieldComparisonValidator *)compareWithChoiceField:(SFormChoiceField *)field validResult:(SFormComparisonRule)expectedResult

Parameters

field

The field the validator will compare against.

expectedResult

The comparison result required to pass validation.

Declared In

SFormChoiceFieldValidators.h

minMaxGroupForMinChoiceField:maxChoiceField:

Sets up a relationship between a minimum choice field and a maximum choice field on a form.

+ (SFormFieldGroup *)minMaxGroupForMinChoiceField:(SFormChoiceField *)minField maxChoiceField:(SFormChoiceField *)maxField

Parameters

minField

The minimum field.

maxField

The maximum field.

form

The form the fields belong to.

Discussion

This helper does the following: - Adds an SFormChoiceFieldComparisonValidator to minField with SFormComparisonRuleLessThan as the expected result. - Adds an SFormChoiceFieldComparisonValidator to maxField with SFormComparisonRuleGreaterThan as the expected result. - Adds both fields to a new SFormValidationGroup and returns the group.

Warning: You need to store a strong reference to the returned SFormFieldGroup.

Declared In

SFormChoiceFieldValidators.h

notEmpty

Returns a validator asserting that a choice field has non-empty content.

+ (SFormChoiceFieldNotEmptyValidator *)notEmpty

Declared In

SFormChoiceFieldValidators.h