I am trying to build a Rails application with w2ui.
I have hit my first snag when trying to submit a form built with w2ui.
I have a simple model called Project
with two attributes: name
and description
.
The standard, scaffolded form built by Rails submits the form data as follows:
project[name]:Test Project
project[description]:A description
However, the form data submitted by w2ui looks as follows:
record[project[name]]:Test Project
record[project[description]]:A description
That is, w2ui wraps the data further in a record
variable, which means I must either change the controller in Rails, which I am not wanting to do, or find a way to get w2ui to not wrap the data the way it does.
My code for w2ui is taken pretty much straight from their demos:
$(function () {
$('#project_form').w2form({
name : 'project_form',
url : '/projects.json',
fields: [
{ name: 'project[name]', type: 'text', required: true },
{ name: 'project[description]', type: 'text' }
],
actions: {
reset: function () {
this.clear();
},
save: function () {
this.submit(); // tried .save() as well, same result
}
}
});
});
First prize would be if w2ui could be configured to do this. Any ideas? I don't see anything in the w2ui docs...