<create-button>

Provides a button that will create a new resource. This is normally used with ajax attributes.

Parameters

  • form

Attributes

All standard ajax attributes are supported, plus:

  • model: The class to instantiate, pass either the class name or the class object. If model is not supplied, the current context (aka this) must be a has-many association.

  • label: the button label. Rather than using this attribute, the best way to customize this label is to set the i18n key <class_name>.actions.new

  • fields: a hash containing fields and their values to set on the new object

Example

<create-button update="foo" label="New" fields="&{name: 'Hello'}"/>

is equivalent to:

<form with="&this.new" update="foo">
  <field-list: replace>
    <hidden-field:name value="Hello"/>
  </field-list:>
  <submit: label="New"/>
</form>

Show Source


Edit this page