|
|
@@ -6,43 +6,6 @@ A definition can have a cardinality and have multiple prevalidators.
|
|
|
|
|
|
Example of some new definitions:
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
- 'm': { //month
|
|
|
- validator: function(chrs, buffer) {
|
|
|
- var dayValue = buffer.join('').substr(0, 3);
|
|
|
- return $.inputmask.defaults.aliases['dd/mm/yyyy'].regex.month.test(dayValue + chrs);
|
|
|
- },
|
|
|
- cardinality: 2,
|
|
|
- prevalidator: [{ validator: "[01]", cardinality: 1}]
|
|
|
- },
|
|
|
- 'y': { //year
|
|
|
- validator: function(chrs, buffer) {
|
|
|
- if ($.inputmask.defaults.aliases['dd/mm/yyyy'].regex.year.test(chrs)) {
|
|
|
- var dayMonthValue = buffer.join('').substr(0, 6);
|
|
|
- if (dayMonthValue != "29/02/")
|
|
|
- return true;
|
|
|
- else {
|
|
|
- var year = parseInt(chrs); //detect leap year
|
|
|
- if (year % 4 == 0)
|
|
|
- if (year % 100 == 0)
|
|
|
- if (year % 400 == 0)
|
|
|
- return true;
|
|
|
- else return false;
|
|
|
- else return true;
|
|
|
- else return false;
|
|
|
- }
|
|
|
- } else return false;
|
|
|
- },
|
|
|
- cardinality: 4,
|
|
|
- prevalidator: [
|
|
|
- { validator: "[12]", cardinality: 1 },
|
|
|
- { validator: "(19|20)", cardinality: 2 },
|
|
|
- { validator: "(19|20)\\d", cardinality: 3 }
|
|
|
- ]
|
|
|
- }
|
|
|
- },
|
|
|
- insertMode: false
|
|
|
-=======
|
|
|
```javascript
|
|
|
'm': { //month
|
|
|
validator: function(chrs, buffer) {
|
|
|
@@ -80,7 +43,6 @@ Example of some new definitions:
|
|
|
},
|
|
|
insertMode: false
|
|
|
```
|
|
|
->>>>>>> dev
|
|
|
|
|
|
These allow for a finer date validation then 99/99/9999 which also allows 33/33/3333 for example.
|
|
|
In the jquery.inputmask.extentions.js you find a full date input validation which takes days, months & leap years into account.
|
|
|
@@ -96,10 +58,7 @@ Include the js-files:
|
|
|
<script src="jquery.js" type="text/javascript"></script>
|
|
|
<script src="jquery.inputmask.js" type="text/javascript"></script>
|
|
|
<script src="jquery.inputmask.extentions.js" type="text/javascript"></script>
|
|
|
-<<<<<<< HEAD
|
|
|
-=======
|
|
|
```
|
|
|
->>>>>>> dev
|
|
|
|
|
|
Define your masks:
|
|
|
|
|
|
@@ -130,11 +89,7 @@ $(document).ready(function(){
|
|
|
});
|
|
|
```
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
-execute a function when the mask is completed, incomplete or cleared
|
|
|
-=======
|
|
|
### execute a function when the mask is completed, incomplete or cleared
|
|
|
->>>>>>> dev
|
|
|
|
|
|
```javascript
|
|
|
$(document).ready(function(){
|
|
|
@@ -267,6 +222,15 @@ $(document).ready(function(){
|
|
|
});
|
|
|
```
|
|
|
|
|
|
+
|
|
|
+### oncleared option
|
|
|
+
|
|
|
+```javascript
|
|
|
+$(document).ready(function(){
|
|
|
+ $("#ssn").inputmask("999-99-9999",{placeholder:" ", oncleared: function(){ alert('Set focus somewhere else ;-)');} });
|
|
|
+});
|
|
|
+```
|
|
|
+
|
|
|
### aliases option
|
|
|
|
|
|
First you have to create an alias definition (more examples can be found in jquery.inputmask.extentions.js)
|
|
|
@@ -330,12 +294,3 @@ Just add the dir="rtl" attribute to the input element
|
|
|
|
|
|
-----------------------------------------
|
|
|
|
|
|
-
|
|
|
-RTL input
|
|
|
-
|
|
|
-Just add the dir="rtl" attribute to the input element
|
|
|
-
|
|
|
-<input id="test" dir="rtl" />
|
|
|
-
|
|
|
------------------------------------------
|
|
|
-
|