PHP Classes

File: public/asset/vendor/jquery-validation/src/additional/nifES.js

Recommend this page to a friend!
  Classes of fathurrahman   mnTemplate   public/asset/vendor/jquery-validation/src/additional/nifES.js   Download  
File: public/asset/vendor/jquery-validation/src/additional/nifES.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: mnTemplate
Route HTTP requests to callback functions
Author: By
Last change:
Date: 1 year ago
Size: 823 bytes
 

Contents

Class file image Download
/* * The Número de Identificación Fiscal ( NIF ) is the way tax identification used in Spain for individuals */ $.validator.addMethod( "nifES", function( value, element ) { "use strict"; if ( this.optional( element ) ) { return true; } value = value.toUpperCase(); // Basic format test if ( !value.match( "((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)" ) ) { return false; } // Test NIF if ( /^[0-9]{8}[A-Z]{1}$/.test( value ) ) { return ( "TRWAGMYFPDXBNJZSQVHLCKE".charAt( value.substring( 8, 0 ) % 23 ) === value.charAt( 8 ) ); } // Test specials NIF (starts with K, L or M) if ( /^[KLM]{1}/.test( value ) ) { return ( value[ 8 ] === "TRWAGMYFPDXBNJZSQVHLCKE".charAt( value.substring( 8, 1 ) % 23 ) ); } return false; }, "Please specify a valid NIF number." );