Browse Source

added getemptymask command to retrieve the default (empty) mask value
this can be usefull to set the defaultvalue in jquery.validate or other validation mechanisms

Robin Herbots 14 years ago
parent
commit
cc534d9865
2 changed files with 15 additions and 1 deletions
  1. 10 0
      README
  2. 5 1
      jquery.inputmask.js

+ 10 - 0
README

@@ -200,3 +200,13 @@ casing can be null, "upper" or "lower"
 $(document).ready(function(){
 $(document).ready(function(){
    $("#test").inputmask("999-AAA");       => 123abc ===> 123-ABC 
    $("#test").inputmask("999-AAA");       => 123abc ===> 123-ABC 
 });
 });
+
+getemptymask command
+
+return the default (empty) mask value
+
+$(document).ready(function(){
+   $("#test").inputmask("999-AAA");    
+   alert($("#test").inputmask("getemptymask"));   => "___-___" 
+});
+

+ 5 - 1
jquery.inputmask.js

@@ -3,7 +3,7 @@ Input Mask plugin for jquery
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 Robin Herbots
 Copyright (c) 2010 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 0.4.6b - dev
+Version: 0.4.6c - dev
  
  
 This plugin is based on the masked input plugin written by Josh Bush (digitalbush.com)
 This plugin is based on the masked input plugin written by Josh Bush (digitalbush.com)
 */
 */
@@ -123,6 +123,10 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
                             }
                             }
                         });
                         });
                         break;
                         break;
+                    case "getemptymask":
+                        if(this.data('inputmask'))
+                    		return this.data('inputmask')['_buffer'].join('');
+                    	else return "";
                     default:
                     default:
                         //check if the fn is an alias
                         //check if the fn is an alias
                         if (!ResolveAlias(fn)) {
                         if (!ResolveAlias(fn)) {