Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8379911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:18:53+00:00 2026-06-09T16:18:53+00:00

In normal scenario user enters details into form fields and submits data. On submission

  • 0

In normal scenario user enters details into form fields and submits data. On submission model validates the data and if validation fails user is redirected to same page with error notifications.

I have a particular scenario in which if the validation fails user should be redirected to a specified page. I DONT want the user be redirected to the same page from where he posted the data.

I went through the cake documentation. But couldnt find anything that mentions a redirect on data validation failure. It can be achieved if im using validating from controller. But here im validating using rules in model only.

Will it be possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:18:55+00:00Added an answer on June 9, 2026 at 4:18 pm

    By default, if data validation fails, the user is not ‘redirected’ anywhere. Cake displays the same view, without any redirecting. The view always shows validation errors, if they exist. So, of course the first time you load the form, there are no errors, but after submitting incorrect data, there are errors. But it’s the exact same view both times, and no redirection is used.

    To fix your problem, modifying the example here: http://book.cakephp.org/2.0/en/models/saving-your-data.html you should be able to do something like:

    // If the form data can be validated and saved...
    if ($this->Recipe->save($this->request->data)) {
        $this->Session->setFlash("Recipe Saved!");
        $this->redirect('/success-page');
    } else {
        $this->Session->setFlash("We Have Errors!");
        $this->redirect('/my-custom-error-page'); // REDIRECT TO YOUR PAGE HERE
    }
    

    Is there any reason that won’t work for you?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a bit confused with setreuid. Scenario: A process runs as normal user
Here's my scenario: <!-- Normal Control --> <div class=required> <label for=address1>Address line 1</label> <input
Generating normal columnar data in excel file is quite easy but does any one
I need to create an utility where user can create their own data entry
Here's the scenario: I have the following user control, the idea is that it's
My ideal scenario would be to have Vim split into two windows - first
I'm using Translate behavior. Here's the scenario: I save a translation on model 'Content'
I have a scenario where I have some text, which should be user-selectable. The
I have a scenario where I have several thousand instances of data. The data
If a normal page load errors I can report the exception details to the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.