3lvis / Form

The most flexible and powerful way to build a form on iOS

Home Page:http://hyper.no

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: Allow custom input validator

aminiz opened this issue · comments

I would like to subclass FORMInputValidator.

This will give us a lot of flexibility. Initially, I need to use it to limit users to certain regex like one that would require a number with 2 decimal digits.

Hi @aminiz,

This should already be possible, gonna put an example.

Thanks @3lvis

All I really need is to be pointed in the right direction.

Damn, went on vacations and forgot about this. Sorry.

@3lvis No worries! I can do any work required for this (be it making an example or implementing something) as long as I know what to do :)

OK! Got the time to add a demo for it, sadly it only works for Objective-C validators.

Form checks for the field id and looks for a validator for it. So if your field id is "External" it will look for FORMExternalValidator, then use that to validate the field.

I added a field with id "branded" for the demo.

https://github.com/hyperoslo/Form/tree/master/Basic-Swift

I hope this works for you, otherwise let me know.

Thanks! I will try them now.

Both FormValidator and FormInputValidator work like a charm!