On Sat, Mar 14, 2009 at 6:32 AM, kaushik <[email protected]> wrote:
>
> I do not want to save the data, I want just if user has entered any
> valid data, the valid data should not be entered again, they should
> remain in the input box and invalid field will be blank with error
> massage. Now he has to entry all the data again.

If you don't remove or change $this->data then the form should be
re-filled by FormHelper when that view is displayed again.

function yourAction()
{
        if (!empty($this->data))
        {
                /* only reach here 2nd time through
                 */
                if ($this->YourModel->validates)
                {
                  if ($this->YourModel->save($this->data)
                  {
                        ...
                        /* you will not reach here if validation failed
                         */
                        $this->redirect(...);
                  }
                }
        }
        // display the form  ...
}

--~--~---------~--~----~------------~-------~--~----~
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