Skip to content

Add validation block #9

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

Merged
merged 7 commits into from
Oct 19, 2014
Merged

Add validation block #9

merged 7 commits into from
Oct 19, 2014

Conversation

mamaral
Copy link

@mamaral mamaral commented Oct 19, 2014

One of the common use-cases I think many could use the SCLAlertView for is a sign-up, login, or similar process. Such processes involve some sort of validation, and it would be nice to be able to validate the fields before the alert is dismissed, like if a required field was left blank, and prevent the alert from being dismissed in this case. This pull request adds a new version of the addButton method that accepts a validation block. If this block returns YES, the actionBlock is executed and the alert is dismissed. If it returns NO the actionBlock is not executed and the alert is not dismissed. Any handling of the failed validation case can be done by the developers inside the validation block prior to passing NO.

@dogo
Copy link
Owner

dogo commented Oct 19, 2014

Pretty cool feature

dogo added a commit that referenced this pull request Oct 19, 2014
@dogo dogo merged commit 1a067ee into dogo:master Oct 19, 2014
@mamaral mamaral deleted the add-validation-block branch June 1, 2015 00:54
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

Successfully merging this pull request may close these issues.

2 participants