All pages
Powered by GitBook
1 of 1

Loading...

IsValid

Validates the incoming value against the given type.

If the type is a range, the value is validated against the range. If the type is a pattern, the value is validated against the pattern. If the type is a date, the value is validated against the date format. If the type is a locale date, the value is validated against the locale date format. If the type is a regular expression, the value is validated against the regular expression.

Note we expressly do not support the `eurodate` type, since date formats vary across EU countries. For this, prefer the `LSIsDate( date, locale )` method instead.

Valid Types

  • array

  • binary

  • boolean

  • component

  • creditcard

Method Signature

Arguments

Argument
Type
Required
Description
Default

Examples

Check to see if a 235 is an integer

Use the isValid function with integer as the type.

Result: true

Validate an Email Address

Use the isValid function with email as the type.

Result: true

Additional Examples

Related

date

  • email

  • float

  • function

  • guid

  • hex

  • integer

  • numeric

  • number

  • query

  • range

  • regex

  • regular_expression

  • social_security_number

  • ssn

  • string

  • struct

  • telephone

  • time

  • time

  • url

  • usdate

  • uuid

  • variablename

  • xml

  • zipcode

  • any

    false

    The minimum value for the range type or a pattern to validate the value against

    max

    any

    false

    The maximum value for the range type

    pattern

    any

    false

    The pattern to validate the value against

    IsBinary
  • IsBoolean

  • IsClosure

  • IsCustomFunction

  • IsDate

  • IsDateObject

  • IsDebugMode

  • IsDefined

  • IsEmpty

  • IsFileObject

  • IsIPv6

  • IsJSON

  • IsLeapYear

  • IsLocalHost

  • IsNull

  • IsNumeric

  • IsNumericDate

  • IsObject

  • IsQuery

  • IsSimpleValue

  • IsStruct

  • IsXML

  • IsXmlAttribute

  • IsXMLDoc

  • IsXMLElem

  • IsXMLNode

  • IsXMLRoot

  • LSIsNumeric

  • structIsEmpty

  • type

    string

    true

    The type to validate the value against

    value

    any

    true

    Value to test for validaty on a given type

    Run Example
    Run Example
    ArrayIsEmpty
    arrayIsEmpty
    Attempt
    IsArray

    min

    IsValid(type=[string], value=[any], min=[any], max=[any], pattern=[any])
    isValid( "integer", 235 );
    
    isValid( "email", "[email protected]" );
    
    <bx:set anArray = [] >
    <bx:set boolean = true >
    <bx:set email = "[email protected]" >
    <bx:set guid = createGUID() >
    <bx:set integer = 15 >
    <bx:set string = "Hello World" >
    <bx:set http_url = "http://www.test.com" >
    <bx:set uuid = createUUID() >
    
    <bx:output>
    	Array: #isValid( "array", anArray )#<br>
    	Boolean: #isValid( "boolean", boolean )#<br>
    	Email: #isValid( "email", email )#<br>
    	GUID: #isValid( "guid", guid )#<br>
    	Integer: #isValid( "integer", integer )#<br>
    	String: #isValid( "string", string )#<br>
    	URL: #isValid( "url", http_url )#<br>
    	UUID: #isValid( "uuid", uuid )#
    </bx:output>