# 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:
  - helma/Html.js, line 45

##### Returns:

A newly created instance of helma.Html

### Classes

TableWriter

### Methods

#### 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:
  - helma/Html.js, line 809

##### 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:
  - helma/Html.js, line 425

#### buttonAsString(param)

Returns a rendered x/html button input tag

##### Parameters:

Name | Type | Description
--- | --- | ---
`param` | Object | An object containing the tag attributes

Source:
  - helma/Html.js, line 446
See:
  - #button

##### 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:
  - helma/Html.js, line 324

#### checkBoxAsString(attr)

Returns a rendered x/html checkbox input tag

##### Parameters:

Name | Type | Description
--- | --- | ---
`attr` | Object | An object containing the tag attributes

Source:
  - helma/Html.js, line 349
See:
  - #checkBox

##### Returns:

The rendered checkbox tag

#### closeLink()

Renders an x/html closing link tag

Source:
  - helma/Html.js, line 676

#### closeLinkAsString()

Returns a rendered x/html closing link tag

Source:
  - helma/Html.js, line 687
See:
  - #closeLink

##### 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:
  - helma/Html.js, line 131

#### closeTagAsString(name)

Returns the closing tag of an arbitray x/html element

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | String | The tag name

Source:
  - helma/Html.js, line 143
See:
  - #closeTag

##### 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:
  - helma/Html.js, line 699

#### colorAsString(c)

Returns a color definition.

##### Parameters:

Name | Type | Description
--- | --- | ---
`c` | String | The color definintion

Deprecated:
  - Yes
Source:
  - helma/Html.js, line 719
See:
  - #color

##### Returns:

The rendered color definition

#### dropDown(param, options, selectedValue, firstOption)

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:
  - helma/Html.js, line 462

#### dropDownAsString(param, options, selectedValue, firstOption)

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:
  - helma/Html.js, line 527
See:
  - #dropDown

##### 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:
  - helma/Html.js, line 179

#### 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:
  - helma/Html.js, line 195
See:
  - #element

##### 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:
  - helma/Html.js, line 778

#### fileAsString(attr)

Returns a rendered x/html file input tag

##### Parameters:

Name | Type | Description
--- | --- | ---
`attr` | Object | An object containing the tag attributes

Source:
  - helma/Html.js, line 795
See:
  - #file

##### 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:
  - helma/Html.js, line 729

#### formAsString(attr)

Returns an x/html opening form tag

##### Parameters:

Name | Type | Description
--- | --- | ---
`attr` | Object | An object containing the tag attributes

Source:
  - helma/Html.js, line 741
See:
  - #form

##### 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:
  - helma/Html.js, line 235

#### 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:
  - helma/Html.js, line 254
See:
  - #hidden

##### 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:
  - helma/Html.js, line 264

#### inputAsString(attr)

Returns a rendered x/html text input tag

##### Parameters:

Name | Type | Description
--- | --- | ---
`attr` | Object | An object containing the tag attributes

Source:
  - helma/Html.js, line 283
See:
  - #input

##### Returns:

The rendered text input tag

#### link(attr, text)

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:
  - helma/Html.js, line 206

#### 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:
  - helma/Html.js, line 225
See:
  - #link

##### 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:
  - helma/Html.js, line 539

#### 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:
  - helma/Html.js, line 566
See:
  - #map

##### Returns:

The rendered image map

#### openLink(attr)

Renders an x/html opening link tag

##### Parameters:

Name | Type | Description
--- | --- | ---
`attr` | Object | An object containing the tag attributes

Source:
  - helma/Html.js, line 657

#### openLinkAsString(attr)

Returns an x/html opening link tag

##### Parameters:

Name | Type | Description
--- | --- | ---
`attr` | Object | An object containing the tag attributes

Source:
  - helma/Html.js, line 669
See:
  - #openTag

##### 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:
  - helma/Html.js, line 108

#### 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:
  - helma/Html.js, line 121
See:
  - #openTag

##### 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:
  - helma/Html.js, line 751

#### passwordAsString(attr)

Returns a rendered x/html password input tag

##### Parameters:

Name | Type | Description
--- | --- | ---
`attr` | Object | An object containing the tag attributes

Source:
  - helma/Html.js, line 768
See:
  - #password

##### 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:
  - helma/Html.js, line 359

#### radioButtonAsString(attr)

Returns a rendered x/html radio input tag

##### Parameters:

Name | Type | Description
--- | --- | ---
`attr` | Object | An object containing the tag attributes

Source:
  - helma/Html.js, line 384
See:
  - #radioButton

##### 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:
  - helma/Html.js, line 394

#### submitAsString(attr)

Returns a rendered x/html submit input tag

##### Parameters:

Name | Type | Description
--- | --- | ---
`attr` | Object | An object containing the tag attributes

Source:
  - helma/Html.js, line 415
See:
  - #submit

##### 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:
  - helma/Html.js, line 592

#### 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:
  - helma/Html.js, line 640
See:
  - #table

##### 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:
  - helma/Html.js, line 154

#### 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:
  - helma/Html.js, line 167
See:
  - #tag

##### 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:
  - helma/Html.js, line 293

#### textAreaAsString(attr)

Returns a rendered x/html textarea tag

##### Parameters:

Name | Type | Description
--- | --- | ---
`attr` | Object | An object containing the tag attributes

Source:
  - helma/Html.js, line 314
See:
  - #textArea

##### Returns:

The rendered textarea tag

#### (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:
  - helma/Html.js, line 89

##### 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:
  - helma/Html.js, line 56