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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:05:21+00:00 2026-05-27T13:05:21+00:00

I have a controller where I am adding some registration values to the table,..

  • 0

I have a controller where I am adding some registration values to the table,.. but in the controller I would like to know if the page validated or not, my issue right now is that when it goes to the model and validates and there is an error, it will come back to the registration page but with the password filled in with the hashed value so I need to add something there like if(validated) do this…. Here is my code

CONTROLLER

<?php
class UsersController extends AppController {

    var $uses = array("User");
    var $components =array('Session');

    function index()
    {
        $this->set('users', $this->User->find('all'));
         $this->layout = 'master_layout';
    }

      function add() { 

          if (!empty($this->data)) {
//HERE I WOULD LIKE TO KNOW IF THE VALIDATION FROM MY MODEL RETURNED VALID OR NOT

             $this->data['User']['user_password'] = Security::hash($this->data['User']['user_password']);
             if ($this->User->save($this->data)) {
                $this->Session->setFlash('Your were registered!.');
                               $this->redirect(array('action' => 'index'));
             }
          }

         $this->layout = 'custom_layout';
      }

}
?>
  • 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-05-27T13:05:22+00:00Added an answer on May 27, 2026 at 1:05 pm

    The easiest solution to this is to set the value attribute for your password input to empty. This is the standard way to do this.

    But if you want to know what the errors are and whether the model validated or not, you can also look at the $this->ModelName->validates() method of the model.

    You can also use this method to get the errors in the model – $this->ModelName->invalidFields()

    Cookbook link – http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller

    This is for CakePHP 1.3

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

Sidebar

Related Questions

I have a controller action which I would like to call another controller action.
I have started learning GWT and I would like to know if it is
I have some issue with validation of parameters passed to a controller method. Following
I have a root view controller with no nib file, I tried adding this
I have a controller with that I want to pass off some data to
I have a View Controller where I select some data into an array and
I'm trying to override a Devise controller to have some minor changes, for example
I have a Rails 3 app that is trying to perform some controller action
I have an ASP.NET WebForms application that I'm adding some ASP.NET MVC to. I
I have an existing rails application to which i am adding a new controller

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.