Framework

- About
- Guides
- Community
- API
- Code
- Download

# Kanso API Documentation

Index | View on single page

## render

Renderer constructors and general utilities for rendering Form objects as HTML.

### errorHTML(errors)

Renders HTML for error messages.

#### Parameters

errors | Array |

Returns: String

### labelText(field, name)

Generates the text for a field's label, depending on whether a custom label is defined or not. If not, the name is captialized and underscores are replaces with spaces to produce the label's text.

#### Parameters

field | Object |
name | String |

Returns: String

### labelHTML(field, name, id)

Generates HTML for label tags.

#### Parameters

field | Object |
name | String |
id | String |

Returns: String

### descriptionHTML(obj)

Generates HTML for field descriptions (if defined).

#### Parameters

obj | Object |

Returns: String

### hintHTML(obj)

Generates HTML for field hints (if defined).

#### Parameters

obj | Object |

Returns: String

### classes(field, errors)

Creates an array of default class names for a field. This includes 'required' for required fields and 'error' for fields failing validation.

All fields are given a 'field' class.

#### Parameters

field | Object |
errors | Array |

Returns: Array

### defaultRenderer()

Determines the default renderer class, to be used globally by instances of forms.Form that fail to specify a renderer class.

Returns: Function

### table

The default table renderer class, passed to the toHTML method of a form. Renders a form using a single table, with

tags to represent nested field groups. The
s are labelled with specific CSS classes, including depth information. See style.css for details on how to style this output.