Fields and methods of the helma.Html
and helma.Html.Tablewriter classes.
To use this optional module, its repository needs to be added to the application, for example by calling app.addRepository('modules/helma/Html.js')
To use this optional module, its repository needs to be added to the application, for example by calling app.addRepository('modules/helma/Html.js')
Creates a new instance of helma.Html
methods
- openTag(name, attr)
- openTagAsString(name, attr)
- closeTag(name)
- closeTagAsString(name)
- tag(name, attr)
- tagAsString(name, attr)
- element(name, str, attr)
- elementAsString(name, str, attr)
- link(attr, text)
- linkAsString(attr, text)
- hidden(param)
- hiddenAsString(attr)
- input(param)
- inputAsString(attr)
- textArea(param)
- textAreaAsString(attr)
- checkBox(param)
- checkBoxAsString(attr)
- radioButton(param)
- radioButtonAsString(attr)
- submit(param)
- submitAsString(attr)
- button(param)
- buttonAsString(param)
- dropDown(param, options, selectedValue, firstOption)
- dropDownAsString(param, options, selectedValue, firstOption)
- map(name, param)
- mapAsString(name, areas)
- table(headers, data, param)
- tableAsString(headers, data, attr)
- openLink(attr)
- openLinkAsString(attr)
- color(c)
- form(attr)
- formAsString(attr)
- password(attr)
- passwordAsString(attr)
- file(attr)
- fileAsString(attr)
- activateUrls(str)
Creates a new TableWriter instance
parameters
Number | numberOfColumns | The number of columns in the table |
Object | attr | An object containing attributes to use when rendering the single table elements. For a description see {@link #table}. |
methods
- write(text, attr)
- close()
properties
- Boolean writeHeader
- Boolean writeString
If set to true the first row of the table data is rendered
using
<th>
tags (defaults to false).If set to true the TableWriter returns the rendered table
as string, otherwise the table is written directly to response,
which is the default.
Methods
Static helper method that renders an arbitrary markup part.
parameters
String | name | The element's name |
String | start | Prefix of each rendered element |
String | end | Suffix of each rendered element |
Object | attr | Optional element attributes |
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
String | value | The current value to check |
String, Array | selectedValue | Either a single value to check against the current value, or an array containing values. |
returns
True in case the value is among the selected values, false otherwise |
Renders the opening tag of an arbitrary x/html tag
parameters
String | name | The tag name |
Object | attr | An optional object containing element attributes |
Returns the opening tag of an arbitrary x/html tag
parameters
String | name | The tag name |
Object | attr | An optional object containing element attributes |
returns
The rendered x/html opening tag |
see
Renders the closing tag of an arbitrary x/html tag
parameters
String | name | The tag name |
Returns the closing tag of an arbitray x/html element
parameters
String | name | The tag name |
returns
The rendered closing tag |
see
Renders an empty arbitrary x/html tag ("contentless tag")
parameters
String | name | The tag name |
Object | attr | An optional object containing tag attributes |
Returns an empty arbitrary x/html tag ("contentless tag")
parameters
String | name | The tag name |
Object | attr | An optional object containing tag attributes |
returns
The rendered element |
see
Renders an arbitrary x/html element
parameters
String | name | The element name |
String | str | The content of the element |
Object | attr | An optional object containing element attributes |
Return an arbitrary x/html element
parameters
String | name | The element name |
String | str | The content of the element |
Object | attr | An optional object containing element attributes |
returns
The rendered element |
see
Renders an x/html link tag
parameters
Object | attr | An object containing the link attributes |
String | text | The text to appear as link |
Returns a rendered x/html link tag
parameters
Object | attr | An object containing the link attributes |
String | text | The text to appear as link |
returns
The rendered link tag |
see
Renders an x/html input tag of type "hidden"
parameters
Object | param | An object containing the tag attributes |
Returns a rendered x/html input tag of type "hidden"
parameters
Object | attr | An object containing the tag attributes |
returns
The rendered input element |
see
Renders an x/html text input tag
parameters
Object | param | An object containing the tag attributes |
Returns a rendered x/html text input tag
parameters
Object | attr | An object containing the tag attributes |
returns
The rendered text input tag |
see
Renders an x/html textarea tag
parameters
Object | param | An object containing the tag attributes |
Returns a rendered x/html textarea tag
parameters
Object | attr | An object containing the tag attributes |
returns
The rendered textarea tag |
see
Renders an x/html checkbox input tag
parameters
Object | param | An object containing the tag attributes |
Returns a rendered x/html checkbox input tag
parameters
Object | attr | An object containing the tag attributes |
returns
The rendered checkbox tag |
see
Renders an x/html radiobutton input tag
parameters
Object | param | An object containing the tag attributes |
Returns a rendered x/html radio input tag
parameters
Object | attr | An object containing the tag attributes |
returns
The rendered element |
see
Renders an x/html submit input tag
parameters
Object | param | An object containing the tag attributes |
Returns a rendered x/html submit input tag
parameters
Object | attr | An object containing the tag attributes |
returns
The rendered submit input tag |
see
Renders an x/html button input tag
parameters
Object | param | An object containing the tag attributes |
Returns a rendered x/html button input tag
parameters
Object | param | An object containing the tag attributes |
returns
The rendered button input tag |
see
Renders a x/html drop down select box
parameters
Object | param | An object containing the tag attributes |
Array | options |
Either an array of strings, an array with
several {value: v, display: d} objects, or a collection
of ["value", "display"] arrays in an array
|
String | selectedValue | The value to pre-select |
String | firstOption | An optional first option to display in the select box (this option will always have no value) |
Returns a rendered x/html drop down select box
parameters
Object | param | An object containing the tag attributes |
Array | options |
Either an array of strings, an array with
several {value: v, display: d} objects, or a collection
of ["value", "display"] arrays in an array
|
String | selectedValue | The value to pre-select |
String | firstOption | An optional first option to display in the select box (this option will always have no value) |
returns
The rendered drop down select box |
see
Renders an image map based on an array containing the map parameters.
parameters
String | name | The name of the image map |
Array | param | An array containing objects, where each of them contains the attributes for a single image map entry |
Returns a rendered image map based on an array containing the map parameters.
parameters
String | name | The name of the image map |
Array | areas | An array containing objects, where each of them contains the attributes for a single image map entry |
returns
The rendered image map |
see
Renders a complete x/html table.
parameters
Array | headers | An array containing table headers |
Array | data | A two-dimensional array containing the table data |
Object | param |
An object containing the following properties:
|
Returns a rendered x/html table
parameters
Array | headers | An array containing table headers |
Array | data | A two-dimensional array containing the table data |
Object | attr | For a description see {@link #table} |
returns
The rendered table |
see
Renders an x/html opening link tag
parameters
Object | attr | An object containing the tag attributes |
Returns an x/html opening link tag
parameters
Object | attr | An object containing the tag attributes |
returns
The rendered open link tag |
see
Renders an x/html closing link tag
Returns a rendered x/html closing link tag
returns
Rhe rendered closing link tag |
see
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
String | c | The color definintion |
Returns a color definition.
parameters
String | c | The color definintion |
returns
The rendered color definition |
see
Renders an x/html opening form tag
parameters
Object | attr | An object containing the tag attributes |
Returns an x/html opening form tag
parameters
Object | attr | An object containing the tag attributes |
returns
The rendered opening form tag |
see
Renders an x/html password input tag
parameters
Object | attr | An object containing the tag attributes |
Returns a rendered x/html password input tag
parameters
Object | attr | An object containing the tag attributes |
returns
The rendered password input tag |
see
Renders an x/html file input tag
parameters
Object | attr | An object containing the tag attributes |
Returns a rendered x/html file input tag
parameters
Object | attr | An object containing the tag attributes |
returns
The rendered file input tag |
see
Parses the string passed as argument and converts any
URL in it into a link tag
parameters
String | str | The string wherein URLs should be converted into link tags |
returns
The string containing URLs converted into link tags |
Writes a single table cell to response.
parameters
String | text | The content of the table cess |
Object | attr | An optional object containig attributes to render for this table cell |
Closes all open table tags. If {@link #writeString} is set to
true, this method returns the rendered table.
returns
The rendered table, if {@link #writeString} is set to true, otherwise void. |