getElementById
A logic command that scans through an HTML document and finds the element with the specified id
attribute value.
If the element is found, a Map is created that contains an entry for every attribute on the element as well as an entry with the key "bodyText" that contains all text the element and its descendants contain. This Maps is then placed into the variable context. If the element is not found, an empty Map is placed into the context instead.
var
String
Defines the name of the variable that will have the element data Map as its value. If an element with the specified id is not found, this Map will be empty.
value
File, DAP Part, String
Defines the HTML content this command will be inspecting. The resolved value may be an HTML File, a DAP Part containing HTML, or a String of HTML.
id
String
Defines the id
attribute value this command will be looking for.
Should the logic have need for the attribute values or text content of a specific element of any HTML value in a variable, getElementById
is the tool for the job. For example, a document edited in a Screen may contain an editable text block expecting a greeting to be written in it, its id
being "greetingBlock". The following command would retrieve the element:
<getElementById var="greetingElem" value="${editedDoc}" id="greetingBlock">
The greeting text written into the block could then be accessed with the expression greetingElem.bodyText
.