[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Vtiger/resources/validator/ -> NumberValidator.js (source)

   1  /*+***********************************************************************************
   2   * The contents of this file are subject to the vtiger CRM Public License Version 1.0
   3   * ("License"); You may not use this file except in compliance with the License
   4   * The Original Code is:  vtiger CRM Open Source
   5   * The Initial Developer of the Original Code is vtiger.
   6   * Portions created by vtiger are Copyright (C) vtiger.
   7   * All Rights Reserved.
   8   *************************************************************************************/
   9  Vtiger_BaseValidator_Js("Vtiger_NumberValidator_Js",{},{
  10      error: "",
  11      validate: function(){
  12          var field = this.fieldInfo;
  13          if(jQuery(field).attr('id') == "probability"){
  14              if (isNaN(field.val())) {
  15                  // this allows the use of i18 for the error msgs
  16                  this.getOnlyNumbersError;
  17              }else if(field.val() > 100){
  18                  this.getProbabilityNumberError;
  19              }
  20          }
  21          if (isNaN(field.val())) {
  22               // this allows the use of i18 for the error msgs
  23              this.getOnlyNumbersError;
  24          }
  25      },
  26  
  27      getOnlyNumbersError: function(){
  28          this.error = "please enter only numbers";
  29          return this.error;
  30      },
  31  
  32      getProbabilityNumberError: function(){
  33          this.error = "please enter only numbers less than 100 as field value is in percentage";
  34          return this.error;
  35      }
  36  })


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1