I am trying Ember EasyForm as a convenience over vanilla forms with validation handling, but my submit action is silently failing and I suspect it is because there is something I should be doing in the controller and view that I am not doing.
Are there any examples or guides I could look at showing the model, controller and template for a form submission in Ember EasyForm? I can not find any documentation or examples of this.
1 Like
To clarify my question: What action in the controller does #form-for call?
I’ve heard that others bypass ember easyForm completely when creating the submit button, and use ember core to create a button action directly:
{{#form-for model}}
{{input title}}
{{input address}}
<button {{action 'save'}}> Save </button>
{{/form-for}}
However, that does not seem programmatic.
I created an issue in the Ember EasyForm issue tracker to clarify what the recommended practice is.
I have the exact same issue. My submit action is never called and @asabjorn’s solution does not take care of keyboard submit. Did anyone have an update about this ?
Just stumbled upon this after playing with easyForm for the first time myself. The easyForm intro blog post at dockYard says “The view for the form element will attempt to call a submit action on the controller”.
I got mine to trigger on the corresponding controller by adding
actions: {
submit: function() {
console.log('called!');
}
}
Also instead of the button with an explicit action as in your code you can just do
{{submit 'Save'}}
or
{{submit 'Save' as='button'}}
to make it use a button tag instead of an input.
Now I’m only trying to figure out how to pass the model from the form into the submit handler…