FUNCTION:  WMLBrowser.setVar

WMLBrowser.setVar(name, value)
The WMLBrowser.setVar function sets the named variable to have the given value and returns a boolean value. A true is returned if the set is successful. A false is returned if the set is not successful.
The syntax of both the name and the value must be correct or invalid will be returned.
The mandatory name parameter is the name of the variable. Note in the example, how the name is enclosed within a pair of double quotation marks.
The mandatory value parameter is the value to be assigned to the named variable. This parameter can be a named variable with an assigned value or you can enclose the value within a pair of double quotation marks.
Code for SetVarExample.wml
<?xml version="1.0"?>

<card id="card1">
   setVar example
   <do type="accept">
      <go href="SetVarExample.wmls#findsetvar()" />

<card id="card2">
   return 1 = $(bool1)
   <br />
   return 2 = $(bool2)
   <br />
   $(varname) = $(varvalue);


Code for SetVarExample.wmls
extern function findsetvar()
   var nam = Dialogs.prompt("Enter the name", "");
   var val = Dialogs.prompt("Enter the value", "");
   var boo1 = WMLBrowser.setVar("varname", nam);
   var boo2 = WMLBrowser.setVar("varvalue", val);
   WMLBrowser.setVar("bool1", boo1);
   WMLBrowser.setVar("bool2", boo2);

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