Categories

ep.validate.basic()

Categories: Utilities

ep.validate.basic( value, [ options ] )

Plugin: ep.validate

Description: Basic validate method.

  • ep.validate.basic( value, [ options ] )

    version added: 6.11.0

    value   A text to validate

    options   A map of additional options pass to the method.

The ep.validate.basic() method is a basic method for validation.

  • Validate a string.

    Code:
    ep.validate.basic( 'Lorem ipsum ...', {
        required:   true,
        pattern:    '^[\w\.]+$',
        minlegth:   10,
        maxlength:  20
    });
    
    Results:
    true
    
    
  • Validate a string with error return.

    Code:
    ep.validate.basic( 'Lorem ipsum ...', {
        required:   true,
        pattern:    '^[\w\.]+$',
        minlegth:   10,
        maxlength:  15
    });
    
    Results:
    NOT_IN_RANGELENGTH
    
    
  • required

    version added: 6.11.0

    A boolean indication wether the value is required.

    Default: false

  • pattern

    version added: 6.11.0

    A pattern string for regular expression.

  • minlength

    version added: 6.11.0

    A minimum number of chars.

  • maxlength

    version added: 6.11.0

    A maximum number of chars.