From 479aee8da18489aa1f636d8c61811ea98ae8174c Mon Sep 17 00:00:00 2001 From: Isidro Vila Verde Date: Mon, 29 Aug 2011 23:33:50 +0100 Subject: [PATCH] Version 0.9.4 --- ChangeLog.txt | 2 + docs/api.html | 94 ++-- docs/docs.html | 6 +- docs/intro.html | 20 +- examples/ex0.html | 24 +- examples/ex1.html | 2 +- examples/ex10.html | 2 +- examples/ex11.html | 2 +- examples/ex12.html | 2 +- examples/ex13.html | 2 +- examples/ex14.html | 2 +- examples/ex15.html | 2 +- examples/ex16.html | 2 +- examples/ex2.html | 2 +- examples/ex3.html | 2 +- examples/ex4.html | 2 +- examples/ex5.html | 2 +- examples/ex6.html | 2 +- examples/ex7.html | 2 +- examples/ex8.html | 2 +- examples/ex9.html | 2 +- examples/index.html | 17 +- examples/make_index.html | 7 + jquery.ht5ifv.js | 87 ++- jquery.ht5ifv.min.js | 102 ++-- jquery.ht5ifv_0.9.4.js | 1093 ++++++++++++++++++++++++++++++++++++++ 26 files changed, 1345 insertions(+), 139 deletions(-) create mode 100644 ChangeLog.txt create mode 100644 jquery.ht5ifv_0.9.4.js diff --git a/ChangeLog.txt b/ChangeLog.txt new file mode 100644 index 0000000..b43011e --- /dev/null +++ b/ChangeLog.txt @@ -0,0 +1,2 @@ +version 0.9.4 +fixed the problem with constructor new Data(ISODateString) in some browsers \ No newline at end of file diff --git a/docs/api.html b/docs/api.html index 33208ff..ec36fbd 100755 --- a/docs/api.html +++ b/docs/api.html @@ -3,7 +3,7 @@ ht5ifv - API - + -
-
+
+

ht5ifv

HTML5 inline form validator

@@ -107,21 +107,21 @@

API - documentation

  1. Options for global and local scope
      -
    1. classes
    2. -
    3. targets
    4. -
    5. callbacks
    6. -
    7. events
    8. -
    9. restrictions
    10. +
    11. classes
    12. +
    13. targets
    14. +
    15. callbacks
    16. +
    17. events
    18. +
    19. restrictions
  2. filter
  3. Options for contexts
      -
    1. radio
    2. -
    3. checkbox
    4. -
    5. select
    6. -
    7. textarea
    8. -
    9. types
    10. +
    11. radio
    12. +
    13. checkbox
    14. +
    15. select
    16. +
    17. textarea
    18. +
    19. types
  4. Boolean options
  5. @@ -160,7 +160,7 @@

    Method .htivf([method],[options])

    when installing the ht5ifv (default init method) or through the static method jQuery.htifv(). For this second alternative see the api for that method
Example: -
+                    
 $(document).ready(function(){
    $('form').ht5ifv();
 });
@@ -185,7 +185,7 @@ 

Options

When the value is a map it associates (sub)states errors with CSS classes
If the developer wishes to change how the flagged error is displayed it may be changed here, as exemplified: -
+                                
 $(document).ready(function(){
    $('form').ht5ifv({
     classes:{
@@ -201,7 +201,7 @@ 

Options

Alternatively a function may be provided. It receives the restriction as a parameter and must return a string with class names that will be used to flag the fields non conforming with the restriction. -
+                            
 $(document).ready(function(){
    $('form').ht5ifv({
     classes: function($r){ return 'my-class-for-'+$r}              
@@ -221,7 +221,7 @@ 

Options

In the compact form it is a function which receives two parameters. The first one is the jQuery object representing the form field and the second is a string representing the type of error -
+                                
 $(document).ready(function(){
  $('form').ht5ifv({
    targets:function($field,$type){return $field}              
@@ -232,7 +232,7 @@ 

Options

Alternatively it may be specified restriction by restriction as a map where the keys are the restriction names. In this case the function only receives one parameter, the jQuery object representing the field where the error occurs. -
+                                
 $(document).ready(function(){
  $('form').ht5ifv({
     targets:{
@@ -258,7 +258,7 @@ 

Options

Like targets it may be defined as an unique, two parameters, function or a map of restrictions and one parameter functions
-
+							
 $(document).ready(function(){
  $('form').ht5ifv({
    callbacks:{
@@ -284,7 +284,7 @@ 

Options

in a space separated string. Each event should be defined in ht5ifv namespace. This is not strictly required but if omitted the ht5ifv won't unbind them when it is destroyed
-
+							
 $(document).ready(function(){
  $('form').ht5ifv({
     events:{  
@@ -295,7 +295,7 @@ 

Options

});
The values by default are: -
+                                
 events:{  
   validate: 'focus.ht5ifv keyup.ht5ifv', //validate every time a key is released or get the focus
   check: 'blur.ht5ifv'                   //only check status on blur 
@@ -313,7 +313,7 @@ 

Options

Those handlers receive two parameters, the first to identify the form field and the second is a boolean to flag if the empty fields should be ignored or not
-
+								
 $(document).ready(function(){
  $('form').ht5ifv({
     restrictions:{  
@@ -351,7 +351,7 @@ 

Options

  • callback: A callback function to be invoked when a (sub)state transition occur
  • -
    +								
     $(document).ready(function(){
     restrictions:{
         data-size:{
    @@ -382,7 +382,7 @@ 

    Options

    (or other selector) except inputs of type button, reset, submit and images. In the end it should return a set of inputs, selects or textareas. It could be a subset, the same set, or even a completely new set of elements of the received one. -
    +                               
     $(document).ready(function(){
         filter:function($fields){return $fields.not('[readonly]');}
     },                              
    @@ -396,7 +396,7 @@

    Options

    • radio
      This element defines a local scope for definitions for inputs of type radio
      -
      +							
       $(document).ready(function(){
        $('form').ht5ifv({
          radio:{  //the target option bellow will be used only by inputs of type radio
      @@ -414,7 +414,7 @@ 

      Options

      By default they won't be visually flagged. A code as the above example could be enough
    By default this option assumes the following values: -
    +                            
     radio:{
         restrictions:{
             required:function ($radioGroup,$node){
    @@ -435,7 +435,7 @@ 

    Options

  • checkbox
    Similar to radio but for ckeckboxes
    By default this option assumes the following values: -
    +                            
     checkbox:{
         restrictions:{
             required: function($node){
    @@ -453,7 +453,7 @@ 

    Options

  • select
    Similar to radio but for selects
    By default this option assumes the following values: -
    +                            
     select:{
         restrictions:{
             required:function ($node){
    @@ -500,7 +500,7 @@ 

    Options

    Some examples
    • Add restricton min-length to password fields -
      +                                    
       $(document).ready(function(){
        $('form').ht5ifv({
          types:{
      @@ -538,7 +538,7 @@ 

      Options

    • Change date format to be mm/dd/yyyy (Simplified! See the function checkDateFormat in ht5ifv code ) -
      +                                    
       $(document).ready(function(){
        $('form').ht5ifv({
          types:{
      @@ -647,6 +647,34 @@ 

      Methods

      Unbind all previous .ht5ifv binds
      This method is chainable.
    • +
      Example:
      +
      +$(document).ready(function(){
      +    var $options = { /*options*/  };
      +    $('#fexample1').ht5ifv($options).ht5ifv('validate'); //init the ht5ifv and then validate
      +    $('#_validate').click(function(){
      +            $('#fexample1').ht5ifv('validate'); //Validate all fields and flag them if they are in error
      +    });
      +    $('#_reset').click(function(){
      +        $('#fexample1').ht5ifv('reset');	//Reset the form. It trigger the jQuery reset event
      +    });
      +    $('#_reload').click(function(){
      +        $('#fexample1').ht5ifv('reload');	//Reload the default values 
      +    });
      +    $('#_clean').click(function(){
      +        $('#fexample1').ht5ifv('clean');	//Clean all fields  
      +    });
      +    $('#_destroy').click(function(){
      +        $('#fexample1').ht5ifv('destroy');	//destroy any ht5ifv data or bind  
      +    });
      +    $('#_init').click(function(){
      +        $('#fexample1').ht5ifv('init',$options);	//Init the ht5ifv  
      +    });
      +    $('#_valid').click(function(){
      +        alert($('#fexample1').ht5ifv('valid'));  //Similiar to validate but returns a boolean
      +    });
      +})                        
      +                        
    @@ -664,7 +692,7 @@

    Method jQuery.htivf([method],[options],[global],[selfContained])

    This is done to avoid conflicts with others extensions.
  • Example:
    -
    +                    
     /********************PT formats extension module************************/
     /* It defines some formats used in Portugal */
     $.ht5ifv('extend',{
    @@ -692,13 +720,13 @@ 

    Method jQuery.htivf([method],[options],[global],[selfContained])

    });
    -
    If you the developer needs to redefine some default +
    If the developer needs to redefine some default options with this method, she should explicit indicate it, by passing the value true on third parameter
    For example if a developer has several html forms where she would like to use they own classes she may redefine them once and use it later several times. -
    +                        
     $.ht5ifv('extend',{        
         classes: function($restriction){return 'my-class-'+$restriction;}
     }, true); //With third parameter true it overlap the global defaults
    diff --git a/docs/docs.html b/docs/docs.html
    index f4013bd..6735083 100755
    --- a/docs/docs.html
    +++ b/docs/docs.html
    @@ -3,7 +3,7 @@
         
                 ht5ifv
                 
    -            
    +            
                 
     			
         
         
    -        
    -
    +
    +

    ht5ifv

    HTML5 inline form validator

    diff --git a/docs/intro.html b/docs/intro.html index 91f4d97..a2fdabd 100755 --- a/docs/intro.html +++ b/docs/intro.html @@ -3,7 +3,7 @@ ht5ifv - + -
    -
    +
    +

    ht5ifv

    HTML5 inline form validator

    Getting start...

    How to use it

    Include these lines into your html head section -
    +				
     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" 
     type="text/javascript" charset="UTF-8"></script>
     
    @@ -74,7 +74,7 @@ 

    Customization

    How

    How the non conforming fields are flagged is controlled through the use of state classes (CSS classes).
    The developer can define CSS classes for each (sub)state as follow: -
    +                
     $(document).ready(function(){
        $('#fexample1').ht5ifv({
           classes:{
    @@ -90,7 +90,7 @@ 

    How

    Where

    Where the non conforming fields are flagged may be controlled through the user defined functions as follow: -
    +                
     $(document).ready(function(){
        $('#fexample1').ht5ifv({
           targets:{
    @@ -105,7 +105,7 @@ 

    Where

    When

    When the conformity should be validate or checked may also be defined: -
    +                
     $(document).ready(function(){
       $('#fexample1').ht5ifv({
         events:{
    @@ -126,7 +126,7 @@ 

    What

    If need the developer could change, suppress, or even add new restrictions
    For the example below the programmer specified that the type password must have an additional restriction through the use of a HTML5 user defined attribute data-min-length
    -
    +                
     $(document).ready(function(){
        $('#fexample1').ht5ifv({
             restrictions:{
    @@ -148,7 +148,7 @@ 

    Extra features: Callbacks

    conform value, or when a check action is performed
    The developer may set a unique callback function for all the possible events or define a function to every event
    -
    +                
     $(document).ready(function(){
        $('#fexample1').ht5ifv({
           callbacks:function($node,$event){
    @@ -164,7 +164,7 @@ 

    Extra features: Callbacks

    Alternatively, a callback function for each restriction can be defined -
    +                
     $(document).ready(function(){
        $('#fexample1').ht5ifv({
           callbacks:{
    diff --git a/examples/ex0.html b/examples/ex0.html
    index 01bc91f..aa48fb1 100755
    --- a/examples/ex0.html
    +++ b/examples/ex0.html
    @@ -6,7 +6,7 @@
     		
     
     		
    -		
    +		
     		
    +		
     		
     		
     		
    +		
     		
    +		
     		
    +		
     		
    +		
     		
    +		
     		
    +		
     		
    +		
     		
     
    -		
    +		
     		
     
     		
    -		
    +		
     		
     
     		
    -		
    +		
     		
     
     		
    -		
    +		
     		
     		
     		
    -		
    +		
     		
     
             
    -		
    +		
     		
     
     		
    -		
    +		
     		
    +