Components Unique Identifiers

From HTML5 Builder
Jump to: navigation, search

All HTML elements have an id attribute. When you generate the output of your components, you should define that attribute when possible, since it makes it possible to use languages such as CSS or JavaScript to access and modify the different HTML elements of the component one by one.

To generate the value for the id attribute of HTML elements, the value of the Name property of the component is used by convention as a prefix. Since Name uniquely identifies a component, using it in the id ensures the resulting identifier will also be unique, even if several instances of the component are used in the same container.

An example of how you can use the component name as prefix is the div wrapper that is automatically placed by the RPCL around controls:

echo "<div id=\"".$Component->Name."_outer\>\n";

If a control is called "MyControl", the div that wraps it will be identified as "MyControl_outer".

Personal tools