Skip to content

[Enhancement Request] Support for non-string form elements #36

@grgcombs

Description

@grgcombs

We use a variety of form field controls beyond text fields and text views, and many of the backing values aren't suitably transferable to strings for validation within the framework.

For instance, on a form that accepts a start date-time and an end date-time for a calendar event, we have a pair of text fields each backed by UIDatePickerViews. In this case, we have a need to validate that the selected end date is on or after the selected start date. However, it seems like we have to cheat the validator a bit in order to convert the NSDate back and forth to a localized formatted date string as the validator triggers the various conditions.

I wound up building a | greater than | less than | equal to | group of conditions and validators that are backed by - (NSComparisonResult)compare:(id)other ... the upside is that it'll work for NSNumbers (like via a slider or stepper) too. But i'm still not quite satisfied with my janky hack.

Perhaps it would make sense to provide an option for a block-based validation that's more agnostic about the data types?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions