I have a situation where I have been handed an already built user interface that contains a tabbed view where each tab contains a form generated using the CakePHP formhelper. Each of these forms has it's own id and the former developer daisy chained ajax requests for each form on a single submit.
The client still wants all forms to post simultaneously so I was hoping I could serialize multiple forms like this:
var post_data = $("#form-1, #form-2").serialize();
$.ajax({
type: "POST",
url: "/places/save_form",
data: post_data,
success: function(result) {},
error: function(result) {}
});
However, in the end point where it posts to I seem to get an empty array from $this->request->data; whereas that returned all my form values when I was serializing a single form.
I also don't get anything in the $_POST once in the controller so it seems like it is being scrubbed before it gets there.
Is there any way to get multiple formhelper forms into a single ajax post and then deal with saving them on the other end?