android-formidable-validation

Additional

Language
Java
Version
N/A
Created
Aug 26, 2012
Updated
Oct 30, 2012 (Retired)
Owner
Linden (coreform)
Contributor
Linden (coreform)
1
Activity
Badge
Generate
Download
Source code

android-formidable-validation

Form validation and feedback library for Android. Provides .setText for more than just TextView and EditText widgets. Provides easy means to validate with dependencies.

Assigning ValueValidators and DependencyValidators to the ValidationManager is simple:

//setup validation
mValidationManager = new ValidationManager(this);

mValidationManager.add("understood", new CheckBoxRequiredValueValidator(mUnderstoodCheckBox, "You must acknowledge that this form does not submit data anywhere and that it is simply for demonstration purposes."));
mValidationManager.add("addressLine1", new RegExpressionValueValidator(mAddressLine1EditText, "^[a-zA-Z0-9\\-'\\s]{3,}$", "please enter your address."));
mValidationManager.add("signupNewsletter");
mValidationManager.add("countrySpinner", new SpinnerRequiredValueValidator(mCountrySpinner, "please select a country."));
mValidationManager.add("emailAddress", new CheckBoxCheckedDependencyValidator(mEmailEditText, "signupNewsletter", mSignupNewsletterCheckBox, true, false, "Please enter your email address to signup to the newsletter list."));
mValidationManager.add("emailAddress", new RegExpressionValueValidator(mEmailEditText, "^([0-9a-zA-Z]([-\\.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$", "Email address must be valid."));
mValidationManager.add("favouriteColour", new ColourPickerButtonValueValidator(mFavouriteColourButton, true));
mValidationManager.add("exampleSetErrorAbleButton", new ColourPickerButtonValueValidator(mExampleSetErrorAbleButton, true));
mValidationManager.add("exampleSetErrorAbleEditText", new RegExpressionValueValidator(mExampleSetErrorAbleEditText, "^[a-zA-Z0-9\\-'\\s]{3,}$", "please enter your address."));

And validating the form is just a matter of:

mValidationManager.validateAllAndSetError();

Some example screenshots:

View the resources in Android Assets Viewer:

http://www.cellebellum.net/AndroidAssetsViewer/?result_id=FormIdableValidation50905f3b3ee0e6.97611575