@@ -109,7 +109,7 @@ abstraction that allows to know when the form is submitting or not (so you can u
109109To do that, you must wrap your inputs around the `validatable-form` component:
110110
111111```html
112- {{#validatable-form onSubmit=(action 'saveUser') as |component |}}
112+ {{#validatable-form onSubmit=(action 'saveUser') as |form |}}
113113 {{#each-in component.errors as |field error|}}
114114 {{field}}: {{error}}
115115 {{/each-in}}
@@ -128,7 +128,7 @@ To do that, you must wrap your inputs around the `validatable-form` component:
128128 <p>Currently saving...</p>
129129 {{/if}}
130130
131- <input type=" submit" value="Submit form">
131+ <input {{action ' submit' target=form}} value="Submit form">
132132{{/validatable-form}}
133133```
134134
@@ -145,9 +145,25 @@ the ID for something more meaningful, you can add the `data-field` attribute to
145145{{input type='password' class='form__input' data-field='Password' required=true}}
146146```
147147
148+ The submit button must contain an action name 'submit', and whose target is set to the validatable form. By default, the validatable form component
149+ will emit the event 'onSubmit', but you can actually override it if your form has multiple actions.
150+
151+ For instance, let's say that your form have one "save" and one "save and activate" button:
152+
153+ ```html
154+ {{#validatable-form onPrimary=(action 'saveAndActivateUser') onSecondary=(action 'saveUser') as |form|}}
155+ // ...
156+
157+ <input {{action 'submit' 'onSecondary' target=form}} value="Save">
158+ <input {{action 'submit' 'onPrimary' target=form}} value="Save and activate">
159+ {{/validatable-form}}
160+ ```
161+
162+ Your controller can now define the `saveAndActivateUser` and `saveUser` actions to properly handle them.
163+
148164### Using with Ember-Data
149165
150- Version 0.1 .* do not offer any Ember Data integration as of today.
166+ Version 0.2 .* do not offer any Ember Data integration as of today.
151167
152168### Cookbook
153169
0 commit comments