Skip to content

amit-bhavsar/ABFormValidator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ABFormValidator

ABFormValidator is the validator library for ios.
It is easy and can validate Email, URL, Username, Password, Quantity, Zipcode, PhoneNumber.

//Types for validation fields
ABValidationTypeEmail
ABValidationTypeURL
ABValidationTypeUserName
ABValidationTypePassword
ABValidationTypeQuantity
ABValidationTypeZipCode
ABValidationTypePhoneNumber
ABValidationTypeSelection


//set the property 
txtEmailField.validationType = ABValidationTypeEmail;  
txtEmailField.inputMinCharacters = 4;  
txtEmailField.inputMaxCharacters = 256; 

//validate the field
ABValidationResult result = [txtEmailField validate];
if (result == ABValidationResultBlank)
{
	[txtEmailField becomeFirstResponder];
	
	[self showAlertWithMessage:@"Please enter email address"];
	
	return NO;
}
else if (result == ABValidationResultMinLength)
{
	[txtEmailField becomeFirstResponder];
	
	[self showAlertWithMessage:[NSString stringWithFormat:@"Email minimum length should be %d",(int)txtEmailField.inputMinCharacters]];
	
	return NO;
}
else if (result == ABValidationResultMaxLength)
{
	[txtEmailField becomeFirstResponder];
	
	[self showAlertWithMessage:[NSString stringWithFormat:@"Email maximum length should be %d",(int)txtEmailField.inputMaxCharacters]];
	
	return NO;
}
else if (result == ABValidationResultEmail)
{
	[txtEmailField becomeFirstResponder];
	
	[self showAlertWithMessage:@"Please enter valid email address"];
	
	return NO;
}

About

ABFormValidator is form validator library for ios.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published