Home batman.js - Data not being submitted to server on create (POST)
Post
Cancel

batman.js - Data not being submitted to server on create (POST)

I couldn’t figure out why my data wasn’t being submitted up to the server on a POST (create). Turns out that the data-bind’s are case sensitive. IE:

1
2
3
4
5
6
class EST.Section extends Batman.Model
  @resourceName: 'section'

  @set 'primaryKey', 'SectionId'
  @persist Batman.RestStorage
  @encode 'SectionId', 'Name'

They need to match up with @encode ‘SectionId’, ‘Name’

1
2
<form id="new_section" data-event-submit="create" data-formfor-section="section">
  <input type="text" placeholder="Section Name" data-bind="section.Name"/>

The POST parameters came across once I specified them as case sensitive.

Batman 0.9

This post is licensed under CC BY 4.0 by the author.