title: How can I make "required" UITextFields?
body: <p>I have a ViewController that contains a series of UITextFields (a form) that my app users fill out and submit (by tapping on a UIButton). The data is posted to an external database (MySQL), and it all works great. However, I want all of the UITextField's to be "required"; in other words, the "submit" button shouldn't post data unless all fields are filled in (contain values). Does anyone know how I might go about doing that? See my code below. </p>
  
  <p><strong>ViewController.h</strong></p>
  
  <pre><code>-(IBAction)addParty:(id)sender;
  
  @property (strong, nonatomic) IBOutlet UITextField *firstname;
  @property (strong, nonatomic) IBOutlet UITextField *lastname;
  @property (strong, nonatomic) IBOutlet UITextField *guestphone;
  @property (strong, nonatomic) IBOutlet UITextField *guestemail;
  @property (strong, nonatomic) IBOutlet UITextField *guestsize;
  
  @end
  </code></pre>
  
  <p><strong>ViewController.m</strong></p>
  
  <pre><code>- (IBAction)addParty:(id)sender
  {
  
  
      NSString *strURL = [NSString stringWithFormat:@"guestfirst=%@&amp;guestlast=%@&amp;guestphone=%@&amp;guestemail=%@&amp;guestsize=%@", firstname.text, lastname.text, guestphone.text, guestemail.text, guestsize.text];
      NSLog(@"%@", strURL);
  
  
      NSData *postData = [strURL dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
      NSString *postLength = [NSString stringWithFormat:@"%d",[postData length]];
      NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
      [request setURL:[NSURL URLWithString:@"postgl.php"]];
      [request setHTTPMethod:@"POST"];
      [request setValue:postLength forHTTPHeaderField:@"Content-Length"];
      [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Current-Type"];
      [request setHTTPBody:postData];
  
  
      NSURLConnection *conn = [[NSURLConnection alloc]initWithRequest:request delegate:self];
  
      if(conn)
      {
          NSLog(@"Connection Successful");
  
          [thankyou setHidden:NO];         
      }
      else
      {
           [thankyou setHidden:YES];
          NSLog(@"Connection could not be made");
      }
  
  }
  </code></pre>