# Handling form submission, params, access to model

**URL:** <https://discuss.emberjs.com/t/handling-form-submission-params-access-to-model/5909>\
**Category:** Ember Data\
**Created:** [July 16, 2014, 8:01am UTC](https://discuss.emberjs.com/t/handling-form-submission-params-access-to-model/5909 "2014-07-16T08:01:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![oliverbarnes](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/oliverbarnes/32/9295_2.png) [@oliverbarnes](https://discuss.emberjs.com/u/oliverbarnes)\
**Post date:** [July 16, 2014, 8:01am UTC](https://discuss.emberjs.com/t/handling-form-submission-params-access-to-model/5909/1 "2014-07-16T08:01:25Z")

</div>

(Warning: newbie) Going around the block on this one, as each example I see does it differently (and none work for me)

```
var InitiativesNewRoute = Ember.Route.extend({
  model: function(params) {
    return this.store.createRecord('initiative', params);
  },

  actions: {
    submit: function() {
      var initiative = this.get('model');
      initiative.save().then(function(model) {
        this.transitionTo('initiatives.show', initiative);
      });
    }
  }
});

```

Saving barfs as initiative is undefined, but I see a record created in the ember chrome plugin. So it looks like creating the record in `model` works, but fetching it in the action doesn’t.

Also tried [this example](https://gist.github.com/aloysius-lim/c793c1383fb17e3f4410#file-app-js-L100):

```
submit: function(initiative) {
  initiative.save().then(function(model) {
    this.transitionTo('initiatives.show', initiative);
  });
}

```

Without passing passing params to createRecord above, and I get the same error. How do I do this?

Using ember-cli 0.0.39 and easy-form, with the fixture adapter.

---

<div class="post-metadata">

**Author:** ![oliverbarnes](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/oliverbarnes/32/9295_2.png) [@oliverbarnes](https://discuss.emberjs.com/u/oliverbarnes)\
**Post date:** [July 17, 2014, 9:48am UTC](https://discuss.emberjs.com/t/handling-form-submission-params-access-to-model/5909/2 "2014-07-17T09:48:09Z")

</div>

Got some help on #emberjs and managed to get it working like this:

```
var InitiativesNewRoute = Ember.Route.extend({
  model: function(params) {
    return this.store.createRecord('initiative', params);
  },

  actions: {
    submit: function() {
      var _this = this;
      var initiative = this.get('controller.model');
      initiative.save().then(function(model) {
        _this.transitionTo('initiatives.show', model.get('id'));
      });
    }
  }
});

```
