I wrote a custom view which looks like this: http://img405.imageshack.us/i/taula.jpg/
This is my controller function with NO save data implemented yet: http://pastebin.com/cU5rprFB
And here is my view: http://pastebin.com/4bYLPp4z
I thought that writing form imput like this:
<td>
<input name="data[Linea][0][proyecto_id]" type="hidden" value=" <?php echo $proyecto['Proyecto']['id'] ?>" />
<input name="data[Linea][0][hito_id]" type="hidden" value=" <?php echo $proyecto['Hito']['id'] ?>" />
<input name="data[Linea][0][tarea_id]" type="hidden" value=" <?php echo $proyecto['Tarea']['id'] ?>" />
<input name="data[Linea][0][total_horas]" type="text" id="LineaTotalHotas" value="" >
</td>
would be sufficient... but it isn't. In the debug_kit I see that hidden data is OK but the data from the input is lost...
Does anyone have an example or something to help me?
UPDATE: I'm trying something like that in my controller:
function addhoras() {
if (!empty($this->data)) {
xdebug_break();
foreach($this->data['Linea'] as $l) {
if ( ($l['total_horas'] != 0) && ( $l['total_horas']!=NULL ) ) {
$this->Linea->create();
if ( $this->Linea->save($l) ) {
} else {
$this->Session->setFlash(__('Arazonbat eon dek', true));
}
}
}
//$this->redirect(array('action' => 'addhoras'));
}
But I'm getting a setflash on the if ( $this->Linea->save($l) ) line... so it is not saving any data... this is the var_dump($l):
array
'proyecto_id' => string ' 1' (length=2)
'hito_id' => string ' 3' (length=2)
'usuario_id' => string ' 1' (length=2)
'fecha' => string '2011-01-01 ' (length=11)
'total_horas' => string '33' (length=2)