setBooleanValue (DOMElement - JavaScript)
Sets the boolean value of an element.
Defined in
DOMElementSyntax
setBooleanValue(value:boolean) : void
setBooleanValue(xpath:string, value:boolean) : void
setBooleanValue(xpath:string, value:boolean, selectionNS:NamespaceContext)
: void
Usage
The signatures with an XPath are equivalent to setBooleanValue in DOMDocument.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
.
setBooleanValue("/schema0/element0",
true)
generates the following XML:<schema0>
<element0>true</element0>
</schema0>
The signature without an XPath sets the value for the current element as it exists in the current hierarchy.
This method replaces all content including child nodes. Append child nodes after calling this method, not before.
Examples
This example is for theonclick
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();
var schema0 = dom.createElement("schema0");
var element0 = dom.createElement("element0");
dom.appendChild(dom.createComment("DOM comment"));
dom.appendChild(schema0);
schema0.appendChild(dom.createComment("Schema comment"));
schema0.appendChild(element0);
if(requestScope.b.toLowerCase() == "true")
element0.setBooleanValue(true);
else
element0.setBooleanValue(false);
element0.appendChild(dom.createComment("Element comment"));
doc.save()
<!--DOM comment-->
<schema0>
<!--Schema comment-->
<element0>true
<!--Element comment-->
</element0>
</schema0>