The session errors are probably because of whitespace after the closing ?> in images.php
The reason you can't save with $this->data may have to do with the fact that there is no 'id' field in your comments table. In your comment model try adding a var $primaryKey = 'id_comment' Take a look at the manual section on conventions. If you do not follow the conventions then Cake needs to be told what to do. With table fields like id_modelname your associations will not work out of the box, because cake is expecting modelname_id. Geoff -- http://lemoncake.wordpress.com On Aug 1, 7:57 am, hb <[EMAIL PROTECTED]> wrote: > <form onSubmit="return false;">'; > > return false? that isnt a good idea, this will keep the form form > submitting any data so remove that. > > On 31 Jul., 22:35, d'plus <[EMAIL PROTECTED]> wrote: > > > I'm new to AJAX as well as to cakephp, so maybe my problem isn't > > difficult to You. > > > i've tried to make something similar > > tohttp://grahambird.co.uk/cake/tutorials/ajax.php > > . I want to update div dynamically in my comments function. > > > first of all - why I can't save my data into model with this: > > $this->Comment->save($this->params['data'])); > > I have to save like this: > > $this->Comment->save(array('id_photo' => $id_photo, 'id_user' => > > $this->data['Comments']['id_user'], 'comment' => $this->data['Comments'] > > > ['comment'])); > > > form: > > <form method="post" action="<? echo $html->url('/comments/add/'. > > $id_photo); "> > > echo $html->input('Comments/comment'); > > echo $html->input('Comments/id_user'); > > echo $html->input('Comments/id_photo'); > > echo '<br>'.$html->submit('add'); > > > I don't have validation rules defined. table: > > CREATE TABLE `pka_comment` ( > > `id_comment` bigint(20) NOT NULL auto_increment, > > `comment` longtext collate latin1_general_ci, > > `id_photo` bigint(20) NOT NULL, > > `id_user` bigint(20) NOT NULL, > > PRIMARY KEY (`id_comment`) > > ) > > > all data is provided. i don't know why it's not saving, and can't > > found any idea how to check the reason. > > > I've got some problems also with posting form data thru ajax submit: > > > echo '<form onSubmit="return false;">'; > > echo $html->input('Comments/comment'); > > echo $html->input('Comments/id_user'); > > echo $html->input('Comments/id_photo'); > > > echo $ajax->submit('Dodaj', array('url' => '/comments/add', > > 'update'=>'photo_'.$id_photo.'_comment')); > > echo '</form>'; > > > With classical form submit, all data is sent and saved without > > problems, but ajax submit, does'nt send anything ... > > > My third problem is with warnings when debug is set > 0: > > > Warning: session_start() [function.session-start]: Cannot send session > > cookie - headers already sent by (output started at D:\www\pka\cake\app > > \views\helpers\images.php:105) in D:\www\pka\cake\cake\libs > > \session.php on line 146 > > > Warning: session_start() [function.session-start]: Cannot send session > > cache limiter - headers already sent (output started at D:\www\pka\cake > > \app\views\helpers\images.php:105) in D:\www\pka\cake\cake\libs > > \session.php on line 146 > > > Warning: Cannot modify header information - headers already sent by > > (output started at D:\www\pka\cake\app\views\helpers\images.php:105) > > in D:\www\pka\cake\cake\libs\session.php on line 147 > > > images.php is custom helper, written by some cakephp user, and > > modified by me. > > line 105 is the last line of file. how to found the reason of this > > warning? > > > I will be very greatfull for helping me. I'm quite new to cake, and > > don't have experience, how to debug effectively. > > also sorry for my poor english:) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
