Skip to content

Commit

Permalink
Build and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
powmedia committed Dec 18, 2013
1 parent f000a12 commit 169def7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ Validators can be defined in several ways:
- **email**: Checks it is a valid email address
- **url**: Checks it is a valid URL
- **match**: Checks that the field matches another. The other field name must be set in the `field` option.
- **regexp**: Runs a regular expression. Requires the `regexp` option, which takes a compiled regular expression.
- **regexp**: Runs a regular expression. Requires the `regexp` option, which takes a compiled regular expression. Setting the `match` option to `false` ensures that the regexp does NOT pass.

####Examples

Expand Down Expand Up @@ -944,6 +944,7 @@ var CustomEditor = Backbone.Form.editors.Base.extend({
###master
- Support regexp validator as string (gregsabia)
- Fix bootstrap3 class list name #329
- Add 'match' option to regexp validator
###0.14.0
- Add Bootstrap 3 templates (powmedia)
Expand Down
3 changes: 2 additions & 1 deletion distribution.amd/backbone-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ Form.validators = (function() {

options = _.extend({
type: 'regexp',
match: true,
message: this.errMessages.regexp
}, options);

Expand All @@ -522,7 +523,7 @@ Form.validators = (function() {
//Create RegExp from string if it's valid
if ('string' === typeof options.regexp) options.regexp = new RegExp(options.regexp, options.flags);

if (!options.regexp.test(value)) return err;
if ((options.match) ? !options.regexp.test(value) : options.regexp.test(value)) return err;
};
};

Expand Down
2 changes: 1 addition & 1 deletion distribution.amd/backbone-forms.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion distribution/backbone-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ Form.validators = (function() {

options = _.extend({
type: 'regexp',
match: true,
message: this.errMessages.regexp
}, options);

Expand All @@ -535,7 +536,7 @@ Form.validators = (function() {
//Create RegExp from string if it's valid
if ('string' === typeof options.regexp) options.regexp = new RegExp(options.regexp, options.flags);

if (!options.regexp.test(value)) return err;
if ((options.match) ? !options.regexp.test(value) : options.regexp.test(value)) return err;
};
};

Expand Down
2 changes: 1 addition & 1 deletion distribution/backbone-forms.min.js

Large diffs are not rendered by default.

0 comments on commit 169def7

Please sign in to comment.