setBooleanValue (DOMDocument - JavaScript)

Sets the boolean value of an element.

Defined in

DOMDocument

Syntax

setBooleanValue(xpath:string, value:boolean) : void

setBooleanValue(xpath:string, value:boolean, selectionNS:NamespaceContext) : void

Parameters Description
xpath XPath of an element in the document.
value The value to be set.
selectionNS A namespace context.

Usage

This method is equivalent to the XPath signatures of setBooleanValue in DOMElement.

In a schema, this data element should be defined as boolean. In the data properties, the display type of a bound field should be String; the value is displayed as true or false.

This method generates a hierarchy of elements to meet the XPath specification. For example, the specification setBooleanValue("/schema0/element0", true) generates the following XML:
<schema0>
  <element0>true</element0>
</schema0>

This method replaces all content including child nodes. Append child nodes after calling this method, not before.

If the XPath includes namespace prefixes, either:

Examples

(1) This example is for the onclick event of a button. It creates a document and sets a value. The requestScope variable is bound to an edit box on the page so the user specifies b before clicking the button.
var doc = database.createNewDocument();
var dom = doc.getDOM();
if(requestScope.b.toLowerCase() == "true")
	dom.setBooleanValue("/schema1/element1", true);
else
	dom.setBooleanValue("/schema1/element1", false);
doc.save()
(2) This example is for the onclick event of a button. It creates a document and sets a value using namespaces. The requestScope variable is bound to an edit box on the page so the user specifies b before clicking the button.
var doc = database.createNewDocument();
var dom = doc.getDOM();
var ns = new NamespaceContextImpl();
ns.addNamespace("s", "http://mynamespace.com");
if(requestScope.b.toLowerCase() == "true")
	dom.setBooleanValue("/s:schema1/s:element1", true, ns);
else
 	dom.setBooleanValue("/s:schema1/s:element1", false, ns);
doc.save()