In a one to many relationship, say a question to answers, and I am using javascript to add some answers to the question. It’s best to add the answer fields as follows in the views (replace 0 with a counter variable or something)
<input name="data[Answer][0][answer]">
and make use of the save associated in the controller’s function that handles adding the question as
$this->Question->saveAssociated($this->request->data)
One thought on “[Cakephp] Save multiple associated data”