Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.

Commit

Permalink
Added support for CPF and CNPJ filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Rogerio Taques committed Nov 9, 2016
1 parent 95e0499 commit 118f21c
Show file tree
Hide file tree
Showing 5 changed files with 234 additions and 66 deletions.
22 changes: 8 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# jQuery Valida 2.1.6
# Valida (jQuery)

[![Latest Version](https://img.shields.io/github/release/rogeriotaques/valida.svg)](https://github.com/rogeriotaques/valida/releases)

Valida is a jQuery plugin which provides an easy, fast and lightweight way to make form validations on client-side.
It's source-code (minified) has about *12Kb*.
Moreover, it's source-code (minified) has about *12Kb*.

[Live Demo](http://awin.com.br/valida)

## What's new since 2.1.3?

* A "flag" mark that highlights required form fields.
* Fixed bug for multiple filters.


##Details
## Details

Validating a form on client-side, using Javascript, can be (at least for me is) a very boring and slower task!

Expand All @@ -33,9 +29,9 @@ label (right below it) with a error/invalid message.
- You also can run some stuff before/after the validation via callback methods and customize the messages
and the layout of messages displayed!

- There are 18 filters available to be used.
- There are 19 filters available to be used.

##How to use it ?
## How to use it ?

Import the "valida.js" on the HEAD of your page:

Expand Down Expand Up @@ -64,7 +60,7 @@ Then, you just need call it:

Done!

##What'll happen ?
## What'll happen ?

When you submit your form (as you usually may do), Valida'll get in action and make the analysis of your form, putting messages (error/warnings) when it's necessary and stopping the form submit for mistakes corrections, moreover, some other nice stuff.

Expand All @@ -75,5 +71,3 @@ Well, that's it! Easy, don't you?
If you have any suggestion, critics or just wanna say hello, feel free to mail me or leave a comments here.

Happy coding! =)

[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rogeriotaques/valida/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
49 changes: 32 additions & 17 deletions sample/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,29 +152,44 @@ <h4 >INPUT TEXTS:</h4>
data-required="Given value must be between 10 and 15" />
</div>

<div class="row" >

<div class="col-xs-12 col-sm-5" >
<label for="field-1-4" >Field 1.4: (required, filter: cpf)</label>
<div class="form-group" >
<input type="text" name="field-1-4" id="field-1-4" maxlength="14"
required="true" filter="cpf:field-1-4" class="form-control"
data-invalid="Given value must be a valid CPF." />
</div>

<label for="field-1-5" >Field 1.5: (required, filter: cnpj)</label>
<div class="form-group" >
<input type="text" name="field-1-5" id="field-1-5" maxlength="18"
required="true" filter="cnpj:field-1-5" class="form-control"
data-invalid="Given value must be a valid CNPJ." />
</div>

<div class="row" >

<label for="field-1-2" >Field 1.4.1: (required, filter: email)</label>
<div class="form-group" >
<input type="text" name="field-1-4-1" id="field-1-4-1" filter="email" class="form-control" required="true"
data-invalid="Must be a valid email address" />
</div>
<div class="col-xs-12 col-sm-5" >

</div>
<label for="field-1-2" >Field 1.4.1: (required, filter: email)</label>
<div class="form-group" >
<input type="text" name="field-1-4-1" id="field-1-4-1" filter="email" class="form-control" required="true"
data-invalid="Must be a valid email address" />
</div>

<div class="col-xs-12 col-sm-7" >
</div>

<label for="field-1-2" >Field 1.4.2: (required, filter: email|matches:field-1-4-1)</label>
<div class="form-group" >
<input type="text" name="field-1-4-2" id="field-1-4-2" filter="email|matches:field-1-4-1" class="form-control" required="true"
data-invalid="Must be a valid email address and match field 1.4.1's value" />
</div>
<div class="col-xs-12 col-sm-7" >

</div>
<label for="field-1-2" >Field 1.4.2: (required, filter: email|matches:field-1-4-1)</label>
<div class="form-group" >
<input type="text" name="field-1-4-2" id="field-1-4-2" filter="email|matches:field-1-4-1" class="form-control" required="true"
data-invalid="Must be a valid email address and match field 1.4.1's value" />
</div>

</div>
</div>

</div>

<hr >

Expand Down Expand Up @@ -296,7 +311,7 @@ <h3 >You can find more interesting stuff at <a href="http://awin.com.br?from=val
</script>

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="../src/valida.2.1.6.min.js"></script>
<script type="text/javascript" src="../src/valida.2.1.7.js"></script>
<script type="text/javascript" >

$(document).ready(function() {
Expand Down
32 changes: 0 additions & 32 deletions src/valida.2.1.6.min.js

This file was deleted.

Loading

0 comments on commit 118f21c

Please sign in to comment.