I enter the value textfiled. I want this to be the correct value, then its ok another wise to show a warning and make the text box empty. So that this user can enter the correct value, I tried many ways, but I do not solve it.
-(void)textFieldTextDidChangeClinicMarkup:(UITextField*)tf{ NSString*test=clinicMarkupTextField.text; if([test isEqualToString:@"1"]){ NSString* value=@ "1"; appDelegate.clinicalMarkup=value; } else if([test isEqualToString:@"1.5"]){ NSString* value=@ "1.5"; appDelegate.clinicalMarkup=value; } else if([test isEqualToString:@"2"]){ NSString* value=@ "2"; appDelegate.clinicalMarkup=value; } else if([test isEqualToString:@"2.5"]){ NSString* value=@ "2.5"; appDelegate.clinicalMarkup=value; } else if([test isEqualToString:@"3"]){ NSString* value=@ "3"; appDelegate.clinicalMarkup=value; } else if([test length] >=3 || [test floatValue] > 3 || [test floatValue] <1 ) { UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"Clinic Markup can only be 1, 1.5, 2, 2.5 and 3 " delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; } }
source share