Hi, I been working in some data validation, and my code works fine when I try to add a new entry in my database table (when I try to save an empty record) BUT, I try to do the same thing when I want to edit an entry of my database table.
- If I change the old content with a new content works fine. - If I change the old content with nothing (blank spaces) the value of table.id disappear If I try to save it. I guess that it is probably a submit form error or something This is my code: Table: tipologia id | name ---------------- 1 | tipologia 1 2 | tipologia 2 3 | tipologia 3 4 | tipologia 4 5 | tipologia 1 file: /models/tipologia.php <?php class Tipologia extends AppModel { var $name = 'Tipologia'; var $validate = array('name' => VALID_NOT_EMPTY ); } ?> file: /controller/tipologias_controller.php function edit($id=null) { $this->set('id', $id); if (empty($this->data)) { $this->data = $this->Tipologia->read(); $this->render(); } { if ($this->Tipologia->save($this->data['Tipologia'])) { $this->redirect('/tipologias/index'); } } } file: /views/tipologias/edit.thtml <form method="post" action="<?php echo $html->url('/tipologias/edit')?>"> <?php echo $html->hidden('Tipologia/id'); ?><p> <table> <tr> <td colspan="2">Edit Tipologia</td> </tr> <tr> <td>ID</td> <td><?php echo $id; ?></td> </tr> <tr> <td>Name</td> <td><?php echo $html->input('Tipologia/name', array('size' => '30', 'maxlength'=>'100'))?><br> <?php echo $html->tagErrorMsg('Tipologia/name', '* Blank Field')?></td> </tr> <!-- Submit information --> <tr> <td colspan="2" bgcolor="#EEEEEE" class="fontFaceB" valign="top"> </td> </tr> <tr> <td> </td> <td><?php echo $html->submit('Save'); ?> <input type="button" onclick="location.href='/cake/tipologias/index';" value="Cancel"/></td> <tr> </table> </form> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~----------~----~----~----~------~----~------~--~---