Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hsnaydd committed Jul 9, 2014
2 parents 0fbc588 + e450785 commit 46d518f
Show file tree
Hide file tree
Showing 27 changed files with 1,642 additions and 850 deletions.
90 changes: 90 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

buildDir: 'dist',

banner: '/*!\n' +
' * Validetta (<%= pkg.homepage %>)\n' +
' * Version <%= pkg.version %> ( <%= grunt.template.today("dd-mm-yyyy") %> )\n'+
' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' +
' * Copyright 2013-<%= grunt.template.today("yyyy") %> <%= pkg.author.name %> - <%= pkg.author.url %> \n' +
' */\n',
clean: {
dist: '<%= buildDir %>'
},

sync: {
all: {
options: {
sync: ['version'],
from: 'package.json',
to: 'bower.json'
}
}
},

replace: {
dist: {
options: {
patterns: [
{ match: 'version', replacement: '<%= pkg.version %>' }
]
},
files: [
{ expand: true, flatten: true, src: ['untracked/validetta.jquery.json'], dest: '' }
]
}
},

concat: {
css: {
options: {
stripBanners: true,
banner: '<%= banner %>\n'
},
src: ['src/<%= pkg.name %>.css'],
dest: '<%= buildDir %>/<%= pkg.name %>.css'
},
js: {
options: {
stripBanners: true,
banner: '<%= banner %>\n'
},
src: ['src/<%= pkg.name %>.js'],
dest: '<%= buildDir %>/<%= pkg.name %>.js'
}
},

cssmin: {
add_banner: {
options: {
banner: '<%= banner %>'
},
files: {
'<%= buildDir %>/<%= pkg.name %>.min.css': ['src/<%= pkg.name %>.css']
}
}
},

uglify: {
options: {
banner: '<%= banner %>'
},
build: {
src: 'src/<%= pkg.name %>.js',
dest: '<%= buildDir %>/<%= pkg.name %>.min.js'
}
}
});

grunt.registerTask('default', 'build');
grunt.registerTask('build', ['clean', 'sync', 'replace', 'concat', 'cssmin', 'uglify']);

grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-npm2bower-sync');
grunt.loadNpmTasks('grunt-replace');
};
181 changes: 32 additions & 149 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,149 +1,32 @@
# Validetta

Validetta is a tiny jQuery plugin which you can do client-side validation of your forms. It aims to decrease your burden with easy usage and flexible structure.

[View Demos](http://lab.hasanaydogdu.com/validetta/#examples)

## What can be done?

* You can check fields whether it is empty or not or it is chosen or not.
* You can do e-mail check.
* You can do number check.
* You can check if the two fields are equal to each other.
* You can check credit card number validation.
* You can limit number of characters written to fields.
* You can limit number of choice of multiple select box or check box.
* By creating your own regular expression, you can check fields according to this regular expression.

## Browser support

The project is tested in Chrome and Firefox. It should work in the current stable releases of Chrome, Firefox, Safari as well as IE8 and up.

## Dependencies

jQuery v1.7 or above.

## How does it work?

It is sufficient to copy downloaded validetta folder to root folder and attach essential folders to your web page. You don’t need to copy validetta folder to root folder but those are applied in the following expression as if validetta is copied to root folder.

include the dependent libraries and css files

```html
<link href="validetta/validetta.css" rel="stylesheet" type="text/css" media="screen" >

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="validetta/validetta.js"></script>
```

You can include language file if you want.

```html
<script type="text/javascript" src="validetta/languages/validettaLang-tr.js"></script>
```

Then, you will only need to call the plugin inside `$(document).ready function`:

```javascript
$(document).ready(function() {
$("#form").validetta();
});
```

and add `data-validetta` attribute to element which you want to validate.

```html
<input type="text" name="example" data-validetta="required,minLength[2],maxLength[3]" />
```

## Checking methods [ ]
- `required` : It checks fields if it is empty or not.
- `number` : It checks fields if it is consist of number or not.
- `email` : It checks E-mail if it is valid or not.
- `creditCard` : It checks credit card number written to fields if it is valid or not.
- `equal[input_name]` : It checks if the two fields are equal to each other according to input name. `input_name` should not be greater than 15 characters!
- `minLength[x]` : It checks fields if it is consist of minimal X character.
- `maxLength[x]` : It checks maximal X character entry to the area.
- `minChecked[x]` : It checks minimal X option if it is marked or not.
- `maxChecked[x]` : It checks maximal X option if it is marked or not.
- `minSelected[x]` : It checks minimal X option if it is chosen or not.
- `maxSelected[x]` : It checks maximal X option if it is chosen or not.
- `customReg[regexp_name]` : It checks if field is suits to identified ordered expression or not. `regexp_name` should not be greater than 15 characters!

## Options { }

### display

You can display errors as inline or bubble

```javascript
{
display : 'bubble' // or inline
}
```

### errorClass

If you want special style, you can add a class to error message with this option.

```javascript
{
errorClass : 'formError'
}
```

### errorClose, errorCloseClass

You can add a close button for error windows, and you can add specific class to it

```javascript
{
errorClose : true,
errorCloseClass : 'formErrorClose'
}
```

### ajax

It provides ajax request after validate process is completed.

```javascript
{
ajax : {
call : true, /* If you want make an ajax request set it true */
type : 'GET', /* Ajax type. Default value is "GET" */
url : null, /* Ajax url. You don’t need to write again here, if you wrote address which your form will be posted. Plugin gets url information from action attribute. */
dataType : 'html', /* Ajax dataType. Default value is "html" */
beforeSend : function(){}, /* Ajax beforeSend function */
success : function(){}, /* Ajax success function */
fail : function(){}, /* Ajax error function */
complete : function(){} /* Ajax complete function */
}
}
```

### realTime

To enable real-time form control, set this option true. Default value is "false"

```javascript
{
realTime : true
}
```

### onCompleteFunc

This is the function to be run after the completion of form control.

```javascript
{
onCompleteFunc : function(){}
}
```

## License

MIT licensed

Copyright (C) 2013 Hasan Aydoğdu, [http://www.hasanaydogdu.com](http://www.hasanaydogdu.com)
# Validetta

Validetta is a tiny jQuery plugin which you can do client-side validation of your forms. It aims to decrease your burden with easy usage and flexible structure.

[View Demos](http://lab.hasanaydogdu.com/validetta/#examples)

## What can be done?

* You can check fields whether it is empty or not or it is chosen or not.
* You can do e-mail check.
* You can do number check.
* You can check if the two fields are equal to each other.
* You can check credit card number validation.
* You can limit number of characters written to fields.
* You can limit number of choice of multiple select box or check box.
* You can use remote validator.
* By creating your own regular expression, you can check fields according to this regular expression.

## Browser support

The project is tested in Chrome and Firefox. It should work in the current stable releases of Chrome, Firefox, Safari as well as IE8 and up.

## Dependencies

jQuery v1.7 or above.

## Documentation
[Official Doc](http://lab.hasanaydogdu.com/validetta/#documentation)

## License

MIT licensed
48 changes: 48 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "validetta",
"description": "A tiny jquery plugin for validate your forms",
"version": "0.9.0",
"homepage": "http://lab.hasanaydogdu.com/validetta/",
"author": {
"name": "Hasan Aydoğdu",
"email": "hasan_aydogdu@windowslive.com",
"url": "http://www.hasanaydogdu.com"
},
"license": {
"type": "MIT",
"url": "https://github.com/hsnayd/validetta/blob/master/LICENCE"
},
"repository": {
"type": "git",
"url": "https://github.com/hsnayd/validetta.git"
},
"main": [
"dist/validetta.css",
"dist/validetta.js"
],
"keywords": [
"form",
"lightweight",
"validetta",
"validate",
"validation",
"validator"
],
"ignore": [
".*",
"test",
"demo",
"untracked",
"*.md",
".json",
"*.html",
"LICENCE",
"Gruntfile.js",
"package.json",
"validetta.jquery.json",
"bower.json"
],
"devDependencies": {
"jquery": ">= 1.7.0"
}
}
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 46d518f

Please sign in to comment.