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

check TextField.text is empty. #122

Closed
ismaiI1 opened this issue Jun 3, 2015 · 2 comments
Closed

check TextField.text is empty. #122

ismaiI1 opened this issue Jun 3, 2015 · 2 comments

Comments

@ismaiI1
Copy link

ismaiI1 commented Jun 3, 2015

i want to check textfield.text and if it's empty then don't dismiss the SCLAlertView. how can i check?

@dogo
Copy link
Owner

dogo commented Jun 3, 2015

    SCLAlertView *alert = [[SCLAlertView alloc] init];

    UITextField *evenField = [alert addTextField:@"Input field"];

    [alert addButton:@"Test Validation" validationBlock:^BOOL{
        if (evenField.text.length == 0)
        {
            [[[UIAlertView alloc] initWithTitle:@"Whoops!" message:@"Empty text field" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
            return NO;
        }
        return YES;
    } actionBlock:^{
        [[[UIAlertView alloc] initWithTitle:@"Great Job!" message:@"Thanks" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
    }];

    [alert showEdit:self title:@"Validation" subTitle:@"Ensure the data is correct" closeButtonTitle:nil duration:0];

@ismaiI1
Copy link
Author

ismaiI1 commented Jun 4, 2015

perfect..! Thanks for your help 👍

@ismaiI1 ismaiI1 closed this as completed Jun 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants