-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
1,642 additions
and
850 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.