All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rwt.util.Validation.js Maven / Gradle / Ivy

Go to download

The Rich Ajax Platform lets you build rich, Ajax-enabled Web applications.

There is a newer version: 3.29.0
Show newest version
/*******************************************************************************
 *  Copyright: 2004, 2012 1&1 Internet AG, Germany, http://www.1und1.de,
 *                        and EclipseSource
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this
 * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
 *
 *  Contributors:
 *    1&1 Internet AG and others - original API and implementation
 *    EclipseSource - adaptation for the Eclipse Rich Ajax Platform
 ******************************************************************************/

/**
 * Collection of validation methods.
 *
 * All methods use the strict comparison operators as all modern
 * browsers (needs support for JavaScript 1.3) support this.
 *
 * http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Operators:Comparison_Operators
 */
rwt.qx.Class.define("rwt.util.Validation",
{
  statics :
  {

    /**
     * Whether a value is a valid number. Valid numbers are:
     * 
    *
  • type is number
  • *
  • not NaN
  • *
* * @type static * @param v {var} the value to validate. * @return {Boolean} whether the variable is valid */ isValidNumber : function(v) { return typeof v === "number" && !isNaN(v); }, /** * Whether a value is valid string. Valid strings are: *
    *
  • type is string
  • *
  • not an empty string
  • *
* * @type static * @param v {var} the value to validate. * @return {Boolean} whether the variable is valid */ isValidString : function(v) { return typeof v === "string" && v !== ""; } } });




© 2015 - 2024 Weber Informatics LLC | Privacy Policy