# Class: AbstractElement

## LuCI.form. AbstractElement

The `AbstractElement` class serves as abstract base for the different form elements implemented by `LuCI.form`. It provides the common logic for loading and rendering values, for nesting elements and for defining common properties.

This class is private and not directly accessible by user code.

#### new LuCI.form.AbstractElement()

form.js, line 184

### Methods

#### append(element)

form.js, line 210

  Add another form element as children to this element.

  Name | Type | Description
  --- | --- | ---
  `element` | AbstractElement | The form element to add.

#### parse(){Promise.<void>}

form.js, line 228

  Parse this elements form input.

  The `parse()` function recursively walks the form element tree and triggers input value reading and validation for each encountered element.

  Elements which are hidden due to unsatisified dependencies are skipped.

  ##### Returns:

  Type | Description
  --- | ---
  Promise.<void> | Returns a promise resolving once this element's value and the values of all child elements have been parsed. The returned promise is rejected if any parsed values are not meeting the validation constraints of their respective elements.

#### abstractrender(){Node|Promise.<Node>}

form.js, line 246

  Render the form element.

  The `render()` function recursively walks the form element tree and renders the markup for each element, returning the assembled DOM tree.

  ##### Returns:

  Type | Description
  --- | ---
  Node | Promise.<Node> | May return a DOM Node or a promise resolving to a DOM node containing the form element's markup, including the markup of any child elements.

#### stripTags(input){string}

form.js, line 286

  Strip any HTML tags from the given input string.

  Name | Type | Description
  --- | --- | ---
  `input` | string | The input string to clean.

  ##### Returns:

  Type | Description
  --- | ---
  string | The cleaned input string with HTML removes removed.

#### titleFn(property, fmt_args){string|null}

form.js, line 320

  Format the given named property as title string.

  This function looks up the given named property and formats its value suitable for use as element caption or description string. It also strips any HTML tags from the result.

  If the property value is a string, it is passed to `String.format()` along with any additional parameters passed to `titleFn()`.

  If the property value is a function, it is invoked with any additional `titleFn()` parameters as arguments and the obtained return value is converted to a string.

  In all other cases, `null` is returned.

  Name | Type | Description
  --- | --- | ---
  `property` | string | The name of the element property to use.
  `fmt_args` | * | repeatable Extra values to format the title string with.

  ##### Returns:

  Type | Description
  --- | ---
  string | null | The formatted title string or `null` if the property did not exist or was neither a string nor a function.