OPERATOR:  isvalid

The isvalid operator is used to test the validity of a variable or the result type of executing an expression. A boolean value is returned to denote the results of the test. A true is returned if the variable or result type is valid. A false is returned if the variable or result type is invalid.
Do not confuse this operator with the URL.isValid function which is used to validate the syntax of a URL address string.
The classic case of an invalid result type for an expression is dividing by zero. In this example, as expected, the isvalid operator returns a false.
Code for IsvalidExample.wml
<?xml version="1.0"?>

<card id="card1">
   isvalid example
   <do type="accept">
      <go href="IsvalidExample.wmls#findisvalid()" />

<card id="card2">
   isvalid = $(valid)


Code for IsvalidExample.wmls
extern function findisvalid()
   var zerodiv = 1/0;
   var valid = isvalid(zerodiv);
   WMLBrowser.setVar("valid", valid);

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information