Designing and Implementing Composite Applications : webMethods CAF and OpenCAF Development Help : User Interface Controls Concepts : Control ID Reference
Control ID Reference
You can assign an ID to every Composite Application Framework control. You can use this ID to reference other controls in the same view, such as the for attribute of a One Way Toggle Button control, and the select item values of a Toggle Button control. Both of these buttons use the control ID reference to specify the control or controls to toggle.
For more information about these controls, see webMethods CAF Tag Library Reference.
You must define a unique control ID for the element within the control's naming container. The following controls are naming containers:
*Form
*Iterator
*Simple List
*Table
*Tabs
*Tree
Absolute References
Control IDs are not unique outside of naming containers, a single view can contain several different controls with the same ID. To distinguish between these controls, the control ID references can include the control's naming container ancestor IDs in the reference. For example, given a form control with an ID of myform and a Hideable Panel control in the form with an ID of myPanel, the absolute control ID reference to the Hideable Panel is :myForm:myPanel. An absolute control ID reference starts with a leading colon (:) and identifies a control from any other control on the page.
Relative References
You can make relative control ID references. A relative reference is corresponding to a specified context, usually the context is a portlet application or naming container. The control ID might also act as a relative reference. For example, to reference the show/hide panel control from a specific control such as a button below the form, you would specify the ID of the panel, myPanel. When a relative reference consists of only a control ID, the reference is resolved by finding the adjacent control to the referencing control with the specified ID.
If another control with the same control ID is closer to the referencing control, you must qualify the reference with part of the absolute reference. For example, there is a panel sibling with an ID of myPanel close to the button, you need to create an unique reference to the first myPanel show/hide panel. To create a relative reference the myPanel control that is in the form, use a relative reference such as myForm:myPanel. Relative control ID references do not start with a leading colon (:), and depend on the location of the referencing control to correctly identify the referenced control.
Absolute Versus Relative
In the relative reference example, the relative control ID reference myForm:myPanel is similar to the absolute control ID reference: myForm:myPanel. Using the relative reference version removes the need to rename the control when changes are made to the container. If you add a new naming container around both the form and the button by importing the view into another view, you can use the same relative reference for the control ID to reference the panel from the button. If you used an absolute reference for the control ID, you would need to prefix to it the naming container's absolute reference control ID. For example, if the Import View's control ID was myImportView, with an absolute reference control ID of :myImportView, the panel's absolute reference control ID must change to :myImportView:myForm:myPanel.
External Portlet References
Some controls can accept a reference to another control outside of the current view, in an external portlet on the same portlet page. An external portlet reference begins with the URI or an alias to the portlet, followed by a pound sign (#), and then by the absolute reference control ID without the leading colon. For example, the myPanel control from the first absolute reference is part of a portlet with an alias of myPortlet. External portlets can reference the myPanel control on the same page as myPortlet#myForm:myPanel.
Literal HTML References
Some controls can accept a reference to a raw HTML element instead of a conventional control ID reference. To reference a raw HTML element, specify the element's ID prefixed with a dollar sign ($). For example, $myDiv references a div tag with an ID of myDiv. You should not use a literal HTML reference when you can use a regular control ID reference.
Nearest Control Algorithm
The nearest control in a relative reference control ID is the closest control in the \ sub-tree to the referencing or source control. The algorithm for finding the nearest control is the following:
*Test the source control.
*Search the descendants of the source control, depth-first.
*Search the siblings of the source control.
*Search the descendants of the siblings of the source control, depth-first.
*Test the parent of the source control.
*Search the siblings of the parent of the source control.
*Search the descendants of the siblings of the parent of the source control, depth-first.
*Test the grandparent of the source control.
*Search the siblings of the grandparent of the source control.
*Search the descendants of the siblings of the grandparent of the source control, depth-first.
Copyright © 2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback