Class: SC.FormView

Extends SC.View.

FormView lays out rows, manages their label widths, binds their content properties, and sets up their contentValueKeys as needed. This class is experimental and not available out of the box.

Usually, you will place rows into the FormView:

childViews: "fullName gender".w(),
contentBinding: 'MyApp.personController',

fullName: SC.FormView.row("Name:", SC.TextFieldView.extend({
  layout: {height: 20, width: 150}

gender: SC.FormView.row("Gender:",{
  layout: {width: 150, height: 40, centerY: 0},
  items: ["male", "female"]

The name of the row (ie. 'fullName'), is passed down to the fields, and used as the key to bind the value property to the content. In this case it will bind content.fullName to the value property of the textFieldView.

Defined in: form.js

Field Summary

Instance Methods

Field Detail


The content to bind the form to. This content object is passed to all children.

All child views, if added at design time via string-based childViews array, will get their contentValueKey set to their own key. Note that SC.RowView passes on its contentValueKey to its child field, and if its isNested property is YES, uses it to find its own content object.


The default padding around items in the form. By default, this comes from the theme. You can supply your own directly, or override the formRenderDelegate:

// base it on the existing render delegate
MyTheme.formRenderDelegate = SC.AceTheme.formRenderDelegate.create({
  flowSpacing: { left: 5, top: 5, right: 5, bottom: 5 }
Whether to automatically start editing.

Rows in the form do not have to be full SC.FormRowView at design time. They can also be hashes that get loaded into rows.

Allows rows to use this to track label width.
labelWidth Number

Supply a label width to avoid automatically calculating the widths of the labels in the form. Leave null to let SproutCore automatically determine the proper width for the label.

Default value:

Instance Method Detail

Tells the child rows whether they should measure their labels or not.
Propagates the label width to the child rows, finding the measured size if necessary.
rowLabelMeasuredSizeDidChange(row, labelSize)
Rows call this when their label width changes.
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:20 GMT-0600 (CST)