Whenever I try to add a new affiliate, the information is saved in the database but without a name. I have been struggling to fix this issue for quite some time now.
class Shop.Views.AffiliatesNew extends Backbone.View
template: JST['affiliates/new']
events:
'submit .form-container': 'addAffiliate'
initialize: ->
@collection.on('reset', @render, this)
@collection.on('add', @render, this)
render: ->
$(@el).html(@template(affiliates: @collection))
this
addAffiliate: (event) ->
event.preventDefault()
@collection.create({
name: $('#first').val()
})
<input type="text" name="name" id="first"/> <br />
.form-title
.submit-container
<input id="affiliate-button" type="submit" value="Submit" />