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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:42:34+00:00 2026-06-10T03:42:34+00:00

I’m trying to implement user registration using yii ActiveRecord. the problem is that every

  • 0

I’m trying to implement user registration using yii ActiveRecord.
the problem is that every time the view is being loaded i get the following exception:

Users has an invalid validation rule. The rule must specify attributes to be validated and the validator name.
#0  
+  /Applications/MAMP/htdocs/yiiRoot/framework/base/CModel.php(259): CModel->createValidators()
#1  
+  /Applications/MAMP/htdocs/yiiRoot/framework/web/helpers/CHtml.php(1758): CModel->getValidators("username")
#2  
+  /Applications/MAMP/htdocs/yiiRoot/framework/web/helpers/CHtml.php(1205): CHtml::activeInputField("text", Users, "username", array("name" => "Users[username]", "id" => "Users_username"))    

here is the relevant part from the Users model:

public function rules()
{
        return array(
        array('username, password, confirmation_uuid, created_at', 'required'),
        array('is_male, is_online, is_idle, is_confirmed', 'numerical', 'integerOnly'=>true),
        array('username, password, first_name, last_name, conformation_uuid', 'length', 'max'=>255),
        array('birthdate, updated_at', 'safe'),
        array('id, username, password, first_name, last_name, birthdate, is_male, is_online, is_idle, is_confirmed, confirmation_uuid, created_at, updated_at', 'safe', 'on'=>'search'),
        array('username','email','allowName'=>true,'allowEmpty'=>false ),
        array('username','required'),
        array('password','application.extensions.validators.password','strength'=>'weak', 'on'=>'register'),
        array('password', 'compare', 'compareAttribute'=>'confirm_password', 'on'=>'register'),
        array('username,password,confirm_password,first_name,last_name,birthdate,is_male,confirmation_uuid','on'=>'register'),

    );
    }

controller:

public function actionRegister()
{
    $form=new Users;
            // collect user input data
            if(isset($_POST['Users']))
            {
                    $form->attributes=$_POST['User']; // set all attributes with post values
                    $form->email=$form->username;

                    // NOTE Changes to any $form->value have to be performed BEFORE $form-validate()
                    // or else it won't save to the database. 

                    // validate user input and redirect to previous page if valid
                    if($form->validate())
                    {
                            // save user registration
                            $form->save();
                            $loginURL = Yii::app()->createUrl('site/login');
                            $this->redirect($this->render('login',array('loginURL'=>$loginURL))); // Yii::app()->user->returnUrl
                    }
            }
            // display the registration form
            $this->render('register',array('form'=>$form));
}

view:

<div class="row">
    <?php echo CHtml::activeLabel($form,'username'); ?>
    <?php echo CHtml::activeTextField($form,'username'); ?>
    <?php //echo $form->error($model,'username'); ?>
</div>

why is it checking the validator at that point? and what causes it to fail?
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-06-10T03:42:35+00:00Added an answer on June 10, 2026 at 3:42 am

    Your last rule

    array('username,password,confirm_password,first_name,last_name,birthdate,is_male,confirmation_uuid','on'=>'register'),
    

    has no validator name. You list all attributes, and then scenario, but not validator name.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of 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.