I am new to iPad developer,
I am making Registration form in my iPad, when user click Submit button i want to validate my textfield whether it is empty or not, if it is empty then it will display alert No cannot be empty.
here is my code snippet but it is not working,
declaration:
UITextField* noTxtbox= [[UITextField alloc] initWithFrame:CGRectMake(250, 200, 180, 50)];
noTxtbox.borderStyle = UITextBorderStyleRoundedRect;
[self.view addSubview:noTxtbox];
Code:
if ([noTxtbox.text isEqualToString:@""]) {
UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Enter your No !"
message:nil delegate:self
cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
[alertView release];
}
Any help will be appreciated.
try using
noTxtbox.text.length == 0