Inherits from NSObject
Declared in SFormField.h
Availability
Related samples

Overview

A field for data entry.

An SFormField is a model object of a field.

Fields can have validators to verify input. See validators for more details.

There are various field model types available:

Tasks

Other Methods

Identifying a Field

  •   title

    The title of this field.

    property

Value

  •   value

    The current value of the field.

    property

Validation

Properties

currentlyFailingValidators

The currently failing validators on the field.

@property (nonatomic, strong, readonly) NSArray *currentlyFailingValidators

Discussion

This array contains an array of objects conforming to SFormInvalidMessageProvider.

Declared In

SFormField.h

isValid

Whether the field is currently valid.

@property (nonatomic, assign, readonly) BOOL isValid

Declared In

SFormField.h

required

Whether this field is required.

@property (nonatomic, assign) BOOL required

Discussion

If a field is required, a validator ensuring that the field is not empty will be added to the validaor array.

This defaults to NO.

Declared In

SFormField.h

title

The title of this field.

@property (nonatomic, retain) NSString *title

Declared In

SFormField.h

validators

An array of validators to be ran when value is updated.

@property (nonatomic, copy) NSArray *validators

Discussion

Each element must adopt the validator protocol appropriate to the field type in question. For example an SFormTextField’s validators must conform to the SFormTextFieldValidator protocol.

Warning: When updating the validators, they will run instantly to verify the currect value.

Declared In

SFormField.h

value

The current value of the field.

@property (nonatomic, copy) id value

Discussion

The type of this property will depend upon the type of field you have chosen. Check the relevant field’s documentation for more information.

Declared In

SFormField.h

Instance Methods

initWithTitle:

Create a field with the given title.

- (instancetype)initWithTitle:(NSString *)title

Parameters

title

The field’s title.

Discussion

This is the designated initializer.

Declared In

SFormField.h