The HTML Helper is a core ColdBox CFC that abstracts the creation of any HTML entity. It provides consistent and secure rendering of HTML within ColdBox applications.
Please check out the latest CFC Docs for all the methods available to the HTML Helper.
There is no special setup needed to use it in a ColdBox application, it's already baked in. Just reference the object by the html
prefix and call the desired function within any layout or view.
By specifying the name
of the element and not the id
, both attributes are output using the same value. You can specify a different value for the id
attribute by explicitly defining it.
You can also pass in any attribute to the registered functions and if it does not match an argument it is passed through into the HTML element:
You can inject the HTML helper anywhere you like by using the following registered mapping: HTMLHelper@coldbox
Note: For interceptors or cases when and object is created before Coldbox activates the HTML Helper module, use the provider:
injection as follows: