Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
grgcombs opened this issue Dec 27, 2013 · 0 comments
Open

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

grgcombs opened this issue Dec 27, 2013 · 0 comments

Comments

@grgcombs
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant