Git Product home page Git Product logo

android-formidable-validation's Introduction

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:

Example 01: ValidationManager automatically calls setError on a Button. Example 02: ValidationManager automatically calls betterSetError on a SetErrorAbleButton. Example 03: ValidationManager automatically calls betterSetError on a SetErrorAbleCheckBox. Example 04: ValidationManager automatically calls setError on an EditText. Example 05: ValidationManager automatically calls betterSetError on a SetErrorAbleSpinner. Example 06: ValidationManager automatically calls betterSetError on a SetErrorAbleEditText. Example 07: ValidationManager automatically calls setError on an EditText due to a validation dependent on a checked CheckBox.

View the resources in Android Assets Viewer:

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.