6 fields"
t1.text
t2.text
t3.text
diam1.text
diam2.text
dial3.text
t1,2,3 must have string of 8 to be later formatted as date i.e. mm/dd/yy
diam1,2,3 must not be zero
Here is the code using Apple's tag method. Note other simple methods will get repeated calls to the Alert that are unacceptable.
/////Start here//////////////Here Goes://////////////////////
//
// AViewController.m
// A
//
// Created by Glenn Tisman on 8/29/11.
// Copyright 2011 Glenn Tisman, M.D. Inc. All rights reserved.
//
#import "AViewController.h"
@implementation AViewController
@synthesize t1;
@synthesize t2;
@synthesize t3;
@synthesize diam1;
@synthesize diam2;
@synthesize diam3;
@synthesize TVDT;
@synthesize SGR;
@synthesize V0;
@synthesize V1;
@synthesize Vrx;
@synthesize VP;
@synthesize RxResponse;
@synthesize t2t1;
@synthesize t3t1;
/////////////////////////////////////////////////////////////////////////
enum {
t1Tag = 0,
t2Tag,
t3Tag,
diam1Tag,
diam2Tag,
diam3Tag,
};//you must go to assign each field manually through the UIView (find that by clicking on the field to tag and checking the UIView for the place to assign each field with a Tag number. //I suspect that this will work with the : -(BOOL) textFieldShouldEndEditing but I have not tried that.
-(void) textFieldDidEndEditing

UITextField *)textField {
switch (textField.tag) {
case 0:
if ([t1.text length] !=8){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Yikes" message:@"Check date one"delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
break;
case 1:
if ([t2.text length] !=8){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Yikes" message:@"Check date two!"delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
break;
case 2:
if ([t3.text length] !=8){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Yikes" message:@"Check date three!"delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
break;
case 3:
if ([diam1.text length] ==0){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Yikes" message:@"Diameter at diagnosis is blank"delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
break;
case 4:
if ([diam2.text length] ==0){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Yikes" message:@"Diameter at start of Rx is blank"delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
break;
case 5:
if ([diam3.text length] ==0){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Yikes" message:@"Diameter post Rx is blank"delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
break;
}