Class: Html

helma.Html()

This class provides various methods for rendering X/Html tags.

Constructor

new Html()

Creates a new instance of helma.Html
Source:
Returns:
A newly created instance of helma.Html

Classes

TableWriter

Methods

(static) isSelected(value, selectedValue)

Static helper method used in helma.Html.checkBox and helma.Html.dropDown to check if a current value matches against one or more selected values passed as argument
Parameters:
Name Type Description
value String The current value to check
selectedValue String | Array Either a single value to check against the current value, or an array containing values.
Source:
Returns:
True in case the value is among the selected values, false otherwise

(static) renderMarkupPart(name, start, end, attr)

Static helper method that renders an arbitrary markup part.
Parameters:
Name Type Description
name String The element's name
start String Prefix of each rendered element
end String Suffix of each rendered element
attr Object Optional element attributes
Source:

activateUrls(str)

Parses the string passed as argument and converts any URL in it into a link tag
Parameters:
Name Type Description
str String The string wherein URLs should be converted into link tags
Source:
Returns:
The string containing URLs converted into link tags

button(param)

Renders an x/html button input tag
Parameters:
Name Type Description
param Object An object containing the tag attributes
Source:

buttonAsString(param)

Returns a rendered x/html button input tag
Parameters:
Name Type Description
param Object An object containing the tag attributes
Source:
See:
Returns:
The rendered button input tag

checkBox(param)

Renders an x/html checkbox input tag
Parameters:
Name Type Description
param Object An object containing the tag attributes
Source:

checkBoxAsString(attr)

Returns a rendered x/html checkbox input tag
Parameters:
Name Type Description
attr Object An object containing the tag attributes
Source:
See:
Returns:
The rendered checkbox tag
Renders an x/html closing link tag
Source:

closeLinkAsString()

Returns a rendered x/html closing link tag
Source:
See:
Returns:
Rhe rendered closing link tag

closeTag(name)

Renders the closing tag of an arbitrary x/html tag
Parameters:
Name Type Description
name String The tag name
Source:

closeTagAsString(name)

Returns the closing tag of an arbitray x/html element
Parameters:
Name Type Description
name String The tag name
Source:
See:
Returns:
The rendered closing tag

color(c)

Renders a color definition string. If the string passed as argument contains only hex characters it will be prefixed with a hash sign if necessary, otherwise this method assumes that the value is a named color (eg. "yellow").
Parameters:
Name Type Description
c String The color definintion
Deprecated:
  • Yes
Source:

colorAsString(c)

Returns a color definition.
Parameters:
Name Type Description
c String The color definintion
Deprecated:
  • Yes
Source:
See:
Returns:
The rendered color definition
Renders a x/html drop down select box
Parameters:
Name Type Description
param Object An object containing the tag attributes
options Array Either an array of strings, an array with several {value: v, display: d} objects, or a collection of ["value", "display"] arrays in an array
selectedValue String The value to pre-select
firstOption String An optional first option to display in the select box (this option will always have no value)
Source:
Returns a rendered x/html drop down select box
Parameters:
Name Type Description
param Object An object containing the tag attributes
options Array Either an array of strings, an array with several {value: v, display: d} objects, or a collection of ["value", "display"] arrays in an array
selectedValue String The value to pre-select
firstOption String An optional first option to display in the select box (this option will always have no value)
Source:
See:
Returns:
The rendered drop down select box

element(name, str, attr)

Renders an arbitrary x/html element
Parameters:
Name Type Description
name String The element name
str String The content of the element
attr Object An optional object containing element attributes
Source:

elementAsString(name, str, attr)

Return an arbitrary x/html element
Parameters:
Name Type Description
name String The element name
str String The content of the element
attr Object An optional object containing element attributes
Source:
See:
Returns:
The rendered element

file(attr)

Renders an x/html file input tag
Parameters:
Name Type Description
attr Object An object containing the tag attributes
Source:

fileAsString(attr)

Returns a rendered x/html file input tag
Parameters:
Name Type Description
attr Object An object containing the tag attributes
Source:
See:
Returns:
The rendered file input tag

form(attr)

Renders an x/html opening form tag
Parameters:
Name Type Description
attr Object An object containing the tag attributes
Source:

formAsString(attr)

Returns an x/html opening form tag
Parameters:
Name Type Description
attr Object An object containing the tag attributes
Source:
See:
Returns:
The rendered opening form tag

hidden(param)

Renders an x/html input tag of type "hidden"
Parameters:
Name Type Description
param Object An object containing the tag attributes
Source:

hiddenAsString(attr)

Returns a rendered x/html input tag of type "hidden"
Parameters:
Name Type Description
attr Object An object containing the tag attributes
Source:
See:
Returns:
The rendered input element

input(param)

Renders an x/html text input tag
Parameters:
Name Type Description
param Object An object containing the tag attributes
Source:

inputAsString(attr)

Returns a rendered x/html text input tag
Parameters:
Name Type Description
attr Object An object containing the tag attributes
Source:
See:
Returns:
The rendered text input tag
Renders an x/html link tag
Parameters:
Name Type Description
attr Object An object containing the link attributes
text String The text to appear as link
Source:

linkAsString(attr, text)

Returns a rendered x/html link tag
Parameters:
Name Type Description
attr Object An object containing the link attributes
text String The text to appear as link
Source:
See:
Returns:
The rendered link tag

map(name, param)

Renders an image map based on an array containing the map parameters.
Parameters:
Name Type Description
name String The name of the image map
param Array An array containing objects, where each of them contains the attributes for a single image map entry
Source:

mapAsString(name, areas)

Returns a rendered image map based on an array containing the map parameters.
Parameters:
Name Type Description
name String The name of the image map
areas Array An array containing objects, where each of them contains the attributes for a single image map entry
Source:
See:
Returns:
The rendered image map
Renders an x/html opening link tag
Parameters:
Name Type Description
attr Object An object containing the tag attributes
Source:

openLinkAsString(attr)

Returns an x/html opening link tag
Parameters:
Name Type Description
attr Object An object containing the tag attributes
Source:
See:
Returns:
The rendered open link tag

openTag(name, attr)

Renders the opening tag of an arbitrary x/html tag
Parameters:
Name Type Description
name String The tag name
attr Object An optional object containing element attributes
Source:

openTagAsString(name, attr)

Returns the opening tag of an arbitrary x/html tag
Parameters:
Name Type Description
name String The tag name
attr Object An optional object containing element attributes
Source:
See:
Returns:
The rendered x/html opening tag

password(attr)

Renders an x/html password input tag
Parameters:
Name Type Description
attr Object An object containing the tag attributes
Source:

passwordAsString(attr)

Returns a rendered x/html password input tag
Parameters:
Name Type Description
attr Object An object containing the tag attributes
Source:
See:
Returns:
The rendered password input tag

radioButton(param)

Renders an x/html radiobutton input tag
Parameters:
Name Type Description
param Object An object containing the tag attributes
Source:

radioButtonAsString(attr)

Returns a rendered x/html radio input tag
Parameters:
Name Type Description
attr Object An object containing the tag attributes
Source:
See:
Returns:
The rendered element

submit(param)

Renders an x/html submit input tag
Parameters:
Name Type Description
param Object An object containing the tag attributes
Source:

submitAsString(attr)

Returns a rendered x/html submit input tag
Parameters:
Name Type Description
attr Object An object containing the tag attributes
Source:
See:
Returns:
The rendered submit input tag

table(headers, data, param)

Renders a complete x/html table.
Parameters:
Name Type Description
headers Array An array containing table headers
data Array A two-dimensional array containing the table data
param Object An object containing the following properties:
  • table: Attributes to render within the opening <table> tag
  • tr: Attributes to render within each <tr> tag
  • td: Attributes to render within each <td> tag
  • th: Attributes to render within each <th> tag
  • trHead: Attributes to render within each <tr> tag in the header area of the table
  • trEven: Attributes to render within each even <tr> tag
  • trOdd: Attributes to render within each odd <tr> tag
  • tdEven: Attributes to render within each even <td> tag
  • tdOdd: Attributes to render within each odd <td> tag
  • thEven: Attributes to render within each even <th> tag
  • thOdd: Attributes to render within each odd <th> tag
Source:

tableAsString(headers, data, attr)

Returns a rendered x/html table
Parameters:
Name Type Description
headers Array An array containing table headers
data Array A two-dimensional array containing the table data
attr Object For a description see #table
Source:
See:
Returns:
The rendered table

tag(name, attr)

Renders an empty arbitrary x/html tag ("contentless tag")
Parameters:
Name Type Description
name String The tag name
attr Object An optional object containing tag attributes
Source:

tagAsString(name, attr)

Returns an empty arbitrary x/html tag ("contentless tag")
Parameters:
Name Type Description
name String The tag name
attr Object An optional object containing tag attributes
Source:
See:
Returns:
The rendered element

textArea(param)

Renders an x/html textarea tag
Parameters:
Name Type Description
param Object An object containing the tag attributes
Source:

textAreaAsString(attr)

Returns a rendered x/html textarea tag
Parameters:
Name Type Description
attr Object An object containing the tag attributes
Source:
See:
Returns:
The rendered textarea tag