Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End CakePHP – Getting validation responce

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #35330
    ChrisBull
    Member

    I have an AJAX login form. I used CakePHP form helpers to create the form but not the error messages.

    The forms data is sent to the controller:

    public function login()
    {
    if ($this->request->is('ajax')) {
    if($this->Auth->login()) {
    echo "logged In";
    } else {
    echo "Login Failed";
    }
    exit;
    }
    }

    I then have in my controller, a validation array:


    public $validate = array(
    'AccountEmail' => array(
    'required' => array(
    'rule' => array('notEmpty'),
    'message' => 'Please Enter A Valid Email.'
    )
    ),
    'AccountPassword' => array(
    'required' => array(
    'rule' => array('notEmpty'),
    'message' => 'Please Enter A Valid Password.'
    )
    )
    );

    At the moment, if I fill in the form with random characters it echos out ‘login Failed’ which is good.

    But how can I access the validation data too see what failed?

    Many Thanks
    Chris

Viewing 1 post (of 1 total)
  • The forum ‘Back End’ is closed to new topics and replies.