友達、
いくつかのアイテムを含む登録フォームがありますが、これらのアイテムのドロップダウン リストがフォームの送信で選択されていないようです。
景色:
</div>
<div class="row">
<?php echo CHtml::activeLabel($model, 'Gjinia'); ?>
<?php echo CHtml::dropDownList('sex', 0, $data = array(0 => 'Mashkull', 1 => 'Femer'))
?>
</div>
<div class="row">
<?php echo CHtml::activeLabel($model, 'Arsimimi'); ?>
<?php echo CHtml::dropDownList('education', 0, $data = array(0 => 'Ulet', 1 => 'Mesem', 2 => 'Larte')) ?>
</div>
<div class="row">
<?php echo CHtml::activeLabel($model, 'Statusi Martesor'); ?>
<?php echo CHtml::dropDownList('marital_status', 0, $data = array(0 => 'Beqar/e', 1 => 'I/E divorcuar', 2 => 'I/E martuar', 3 => 'I/E veje')) ?>
</div>
検証規則:
public function rules() {
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('name, lastname, sex, education,
marital_status, employment,
dob, municipality, address,
cell_no, email, initialPassword,
repeatPassword', 'required'),
array('sex, employment, municipality,', 'numerical', 'integerOnly' => true),
array('email, initialPassword, repeatPassword, name, lastname', 'length', 'max' => 100),
array('initialPassword, repeatPassword', 'required', 'on' => 'insert'),
array('initialPassword, repeatPassword', 'length', 'min' => 6, 'max' => 40),
array('initialPassword', 'compare', 'compareAttribute' => 'repeatPassword'),
);
}
フォームを送信した後、$_POST['Auser'] で print_r を実行すると、次のようになります。
Array ( [name] => Name [lastname] => Lname [address] => B ellit
[cell_no] => 044 568 178 [email] => gzzi@gmail.com [id] => [sex] =>
[education] => [marital_status] => [employment] => [industry] => [dob] =>
[municipality] => [password] => )
およびエラーメッセージ:
Sex cannot be blank.
Education cannot be blank.
Marital Status cannot be blank.
Employment cannot be blank.
Dob cannot be blank.
Municipality cannot be blank.