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 7896923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:01:07+00:00 2026-06-03T08:01:07+00:00

What will I add to the controller to display the messages and halt saving

  • 0

What will I add to the controller to display the messages and halt saving before validation is true?

class Rsvp extends AppModel {
var $name = 'Rsvp';
var $validate = array(
                'uname' => array(
                                'rule' => array('alphaNumeric', true),
                                'message' => 'Please enter a vlaid name that does not contain digits'),
                'uemail' => array(
                                'rule' => array('email', true),
                                'message' => 'Please supply a valid email address.')


);

}

Controller

public function add() {


    if ($this->request->is('post')) {

        var_dump($this->request->data);
        $this->Rsvp->set('uname', $this->request->data['Post']['name']);
        $this->Rsvp->set('uemail', $this->request->data['Post']['emailaddress']);           
          //Begin Validation Routine
        echo 'Validation';
        var_dump($this->Rsvp->validates);


        $this->Rsvp->save();    
        /*if($this->Rsvp->save()) {
            $this->Session->setFlash('You have RSVP for the event');
           // $this->redirect(array('action' => 'index'));              
        }
        else {
            $this->Session->setFlash('Unable to RSVP you for the event.');
        }*/
    }
}
  • 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-03T08:01:09+00:00Added an answer on June 3, 2026 at 8:01 am

    Do you mean something like:

    if($this->Rsvp->validates()) {
       //data validated, so save
       $this->Rsvp->save($this->data);    
    }
    else {
       $this->Session->setFlash(__('Fill in all required fields.', true));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I need to extend the CListControl class in C++/MFC, which will add several
I have a TableView controller class that uses a fetched results controller to display
The following code will add the categories selector widget to the WordPress Page editor
We are making a game which will add a level editor feature soon. We
I'm writing an application that will add users to Active Directory. I'm trying to
So the ENTER_FRAME property will add an object to the stage on every frame
I have a button that, when pressed, will add a new HTML row. Within
I have this form right here, where the user will add the start date
I'm working on a module that, among other things, will add some generic 'finder'
Basically, I want an invisible NSView covering my entire screen. I will add an

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.