Generating a unique ID for a coach view

In some situations you might want to use the ID attribute for your DOM elements within a coach view. However, all DOM IDs must be globally unique. For example, during collaboration the default highlighting behavior is implemented based on a unique DOM ID. To ensure a unique ID, you can use the $$viewDOMID$$ placeholder keyword. At run time, this keyword will be replaced by the coach view DOM ID.

About this task

Because coach views are reusable, multiple instances of the same coach views could be used in a single coach. As a result, unique DOM IDs are generated for all coach views automatically. By using $$viewDOMID$$ in your coach view implementation, you can ensure that all of your DOM elements have DOM IDs that are globally unique. For example, you might want to highlight an element such as a button at run time. You can create your element using custom HTML, and assign the DOM ID attribute by prefixing with $$viewDOMID$$. When the view is rendered, the $$viewDOMID$$ attribute will be replaced by a unique ID (the DOM ID of your coach view) for the element.

Procedure

To generate a unique ID:
  • Open the coach view
  • Switch to the Layout page
  • Create a custom HTML control.
  • Enter custom HTML code, and use $$viewDOMID$$ in the id attribute:
    <div id="$$viewDOMID$$_myId1">   
     <span id="$$viewDOMID$$_myId2"></span>   
     <input id="$$viewDOMID$$_myId3" type="button" class="Jquerybutton" name="jbtnName" value="default"></input>
    </div>
    Tip: To avoid potential conflicts, use a meaningful suffix after $$viewDOMID$$, for example $$viewDOMID$$_buttonDiv.