try removing $this->Message->id = $id; and adding parameters to read
function at the bottom

$this->data = $this->Message->read(null, $id);

and placing a hidden input file in your form for message id

echo $form->hidden('Message.id');



On Oct 6, 11:22 am, "Arak Tai'Roth" <[email protected]> wrote:
> So, my subject name might be misleading. This is why I'm posting on
> here because I don't have much of an idea of what to search for in
> order to find a solution.
>
> So here is my issue. I have a controller with an edit function. The
> page loads fine, it edits fine, and it invalidates fields fine, and it
> shows which fields had the error fine. However that's where the
> problem starts that I noticed. If a user types in data that gets
> invalidated, and then tries to submit it again, it brings up an error
> that the $id field is missing from the argument (the url), and it is
> missing. If the user invalidates some data, corrects the issue, and
> then clicks submit, the data isn't saved but it says it was saved
> correctly.
>
> So my question is, what can I do so that a user can get an invalidated
> message, but everything will continue working as it is supposed to.
> Here is my code for the edit function, if you need anything else
> please just ask.
>
>                 function edit($id)
>                 {
>                         $this->Message->id = $id;
>
>                         if (!empty($this->data['Message']))
>                         {
>                                 $mrClean = new Sanitize();
>                                 $this->data['Message']['message'] = 
> $mrClean->clean($this->data
> ['Message']['message'], array('encode' => 0, 'escape' => 0));
>                                 $this->data['Message']['modified'] = 
> date('Y-m-d G:i:s');
>
>                                 if 
> ($this->Message->save($this->data['Message']))
>                                 {
>                                         $this->Session->setFlash('The Pastors 
> Message has been edited.');
>
>                                         $this->redirect('/');
>                                         $this->exit();
>                                 }
>                                 else
>                                 {
>                                         $this->Session->setFlash('The Pastors 
> Message could not be
> edited.');
>                                 }
>                         }
>                         else
>                         {
>                                 $this->data = $this->Message->read();
>                         }
>                 }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to