-(BOOL)validateInput{
BOOL retvalue=YES;
NSString *throwmessage;
if ([LocationName.text isEqualToString:@""] || LocationName.text==nil )
{
throwmessage=@"Please Enter Location Name";
retvalue=NO;
}
else if ([City.text isEqualToString:@""] || City.text==nil )
{
throwmessage=@"Please Enter City ";
retvalue=NO;
}
else if ([Area.text isEqualToString:@""] || Area.text==nil )
{
throwmessage=@"Please Enter Area ";
retvalue=NO;
}
else if ([State.text isEqualToString:@""] || State.text==nil )
{
throwmessage=@"Please Enter State";
retvalue=NO;
}
else if ([Country.text isEqualToString:@""] || Country.text==nil )
{
throwmessage=@"Please Enter Contact Number ";
retvalue=NO;
}
if (retvalue==NO)
{
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:nil message:throwmessage delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[alert show];
[alert release];
}
return retvalue;
}
Check 0r call this function When Required
Such AS
-(IBAction)Save{
if([self validateinput]){
}
else{
}
0 comments:
Post a Comment