Inherits from NSObject
Declared in SFormTextFieldValidators.h
Availability
Related samples

Overview

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

Tasks

Text Field Validation

Class Methods

compareWithTextField:comparisonMode:validResult:

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

+ (SFormTextFieldComparisonValidator *)compareWithTextField:(SFormTextField *)field comparisonMode:(SFormTextComparisonMode)comparisonMode validResult:(SFormComparisonRule)validResult

Parameters

field

The field the validator will compare against.

comparisonMode

An option representing how to interpret the text as a value for comparison.

expectedResult

The comparison result required to pass validation.

Declared In

SFormTextFieldValidators.h

email

Returns a validator to check that a text field contains a valid email address. E.g. info@shinobicontrols.com.

+ (SFormTextFieldEmailValidator *)email

Declared In

SFormTextFieldValidators.h

minMaxGroupForMinTextField:maxTextField:comparisonMode:

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

+ (SFormFieldGroup *)minMaxGroupForMinTextField:(SFormTextField *)minField maxTextField:(SFormTextField *)maxField comparisonMode:(SFormTextComparisonMode)comparisonMode

Parameters

minField

The minimum field.

maxField

The maximum field. param comparisonMode An option representing how to interpret the text as a value for comparison.

Discussion

This helper does the following: - Adds an SFormTextFieldComparisonValidator to minField with SFormComparisonRuleLessThan as the expected result. - Adds an SFormTextFieldComparisonValidator 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

SFormTextFieldValidators.h

notEmpty

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

+ (SFormTextFieldNotEmptyValidator *)notEmpty

Declared In

SFormTextFieldValidators.h

numeric

Returns a validator to check that a text field contains a valid numeric string.

+ (SFormTextFieldNumericValidator *)numeric

Declared In

SFormTextFieldValidators.h