public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('firstname, lastname, password, email, referrer_id, referral_type, can_refer, telephone, emailConfirmation, passwordConfirmation, acceptedTerms, company_id', 'required', 'on' => 'register'),
array('firstname, lastname, email, telephone', 'required', 'on' => 'user'),
array('status, referrer_id, referral_type, company_id, can_refer, address_id', 'numerical', 'integerOnly' => true),
array('firstname, occupation, lastname, password, email, telephone, ip_address', 'length', 'max' => 255),
array('last_login','safe'),
array('email', 'email'),
array('email', 'unique'),
array('telephone', 'telephoneValidation'),
array('password, passwordConfirmation', 'length', 'min' => 6),
array('passwordConfirmation', 'compare', 'compareAttribute' => 'password', 'on' => 'register'),
array('emailConfirmation', 'compare', 'compareAttribute' => 'email', 'on' => 'register'),
array('acceptedTerms', 'acceptedTerms', 'on' => 'register'),
array('email', 'userExists', 'on' => 'register'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('referral_type, id, occupation, firstname, lastname, password, email, status, telephone, mobile, created_at, modified_at, referrer_id, company_id, ip_address, last_login, can_refer, address_id', 'safe', 'on' => 'search'),
);
}
<?php echo $form->labelEx($u, 'company_id'); ?>
<?php echo $form->dropDownList($u, 'company_id', $companylistData, array("empty" => "Your Employer?")) ?>
<?php echo $form->error($u, 'company_id') ?>