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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:58:21+00:00 2026-05-24T07:58:21+00:00

I have run into a bizarre issue with the username being validated (as the

  • 0

I have run into a bizarre issue with the username being validated (as the title says) in the edit view which renders me unable to save the form. I do not have an input in this view for the username, so why is this this being validated (and failing)?

Validation is as follows:

var $validate = array(
               'username' => array(
            'empty' => array(
                                'rule' => 'notEmpty',
                                'required' => true,
                                'allowEmpty' => false,
                                'message' => 'Username is required',
            ),
            'isUnique' => array(
                                'rule' => 'isUnique',
                                'message' => 'This username has already been taken'
            ),
            'pattern' => array(
                                'rule' => array('custom','/[a-zA-Z0-9\_\-]{6,}$/i'),
                                'message' => 'Must be 6 characters or longer with no spaces',
            ),
            'length' => array(
                                'rule' => array('maxLength', 15),
                                'message' => 'Please keep username under 15 characters',
            ),
            'notEmpty' => array(
                                'rule' => 'notEmpty',
                                'message' => 'Username cannot be empty',
            )
);

the edit function below:

   function edit($id = null) {
            $this->set('title_for_layout', 'Edit Profile');
            unset($this->User->validate['email']['email']);
            unset($this->User->validate['username']);
            if($this->Auth->user('id')==$id) {
                $this->set('user', $this->User->read(null, $id));
                } else {
                    $this->Session->setFlash(__('You are not authorised to edit other member profiles', true));
                    $this->redirect(array('action' => 'index'));
        }
        if (!empty($this->data)) {
            if ($this->User->save($this->data)) {
                $this->Session->setFlash(__('Your profile has been saved', true));
                $this->redirect(array('action' => 'index'));
            } else {
                $this->Session->setFlash(__('Your profile could not be saved. Please, try again.', true));
            }
        }
        if (empty($this->data)) {
            $this->data = $this->User->read(null, $id);
        }
        $groups = $this->User->Group->find('list');
        $this->set(compact('groups'));
    }

I have unset the username which then only allows me to save the form, but this cannot be the correct method for doing this. Could anyone shed some light on this?

Many thanks!

  • 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-24T07:58:23+00:00Added an answer on May 24, 2026 at 7:58 am

    The required => true is making the ‘username’ key a required field, meaning if you just try to update settings or something without the username key, it will invalidate.

    I’ve not done it myself, but try adding 'on' => 'create' to the empty rule so it only applies when the record is being created.

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

Sidebar

Related Questions

I have run into an issue with WPF and Commands that are bound to
I have run into an issue with JQuery form submissions and have found no
I seem to have run into a strange issue whereby a string reference is
I have run into a common, yet difficult problem. I do not use Photoshop
I have run into a bit of a tricky problem in some C++ code,
I have run into a few cases where i have been asked to deploy
it seems I have run into a problem with Internet Explorer 7. I have
I have been playing with javascript arrays and I have run into, what I
I am working on a web application and I have run into the following
I'm using SWFUpload to handle file uploads and have run into a problem where

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.