# Class: BackboneFormBehavior

## module:core.form.behaviors. BackboneFormBehavior

This behavior turns any Marionette.View into Backbone.Form. To do this Backbone.Form scans this.$el at the moment defined by `options.renderStrategy` and puts field and editors defined in `options.schema` into DOM-elements with corresponding Backbone.Form data-attributes. It's important to note that Backbone.Form will scan the whole this.$el including nested regions that might lead to unexpected behavior. Possible events:

- `'form:render' (form)` - the form has rendered and available via `form` property of the view.

#### new BackboneFormBehavior(options, view)

  Marionette.Behavior constructor shall never be called manually. The options described here should be passed as behavior options (look into Marionette documentation for details).

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---

  `options`

  Object

  Options object.

  ###### Properties

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `schema` | Object | function |  |  | Backbone.Form schema as it's listed in [docs](https://github.com/powmedia/backbone-forms).
  `model` | Object | function | <optional> |  | Backbone.Model that the form binds it's editors to. `this.model` is used by default.

  `renderStrategy`

  String

  <optional>

  'show'

  Defines a moment when the form is applied to the view. May be one of:
  - `'render'` - On view's 'render' event.
  - `'show'` - On view's 'show' event.
  - `'manual'` - Form render method (`renderForm()`) must be called manually.

  `field` | Backbone.Form.Field | <optional> |  | Backbone.Form.Field that will be used to render fields of the form. The field `core.form.fields.Field` is used by default.

  `view` | Marionette.View | A view the behavior is applied to.

### Extends

- Marionette.Behavior

#### Search results