我的下拉菜单是看不见的

时间:2017-01-04 21:51:38

标签: php html css yii

我想在我的注册表中输入一个下拉菜单。表格的其余部分正确显示并且工作正常,但下拉列表是不可见的。

我到处寻找,无法找到问题的解决方案。有人帮忙吗?

<?php

$this->pageTitle=Yii::app()->name . ' - Register';

function generateRandomString($length = 1) {
    $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $charactersLength = strlen($characters);
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[rand(0, $charactersLength - 1)];
    }
    return $randomString;
}
$letter =  generateRandomString();
$studentNumber = $letter.rand(1111111,9999999);


$roleArray = array('student' => 'student');

$RolesMappingModel = Roles::model();
//$criteria=new CDbCriteria;


if(Yii::app()->user->isGuest){
    //$userRole = Yii::app()->user->Roles;
    $userRole = Yii::app()->user->getState("roles");
    switch($userRole) {
        case "student":
            $roleArray = array('2' => 'student');

            break;
        case "lecturer":
            $roleArray = array('3' => 'lecturer','2' => 'student');
            break;
        case "superadmin":
            $roleArray = array ('1' => 'superadmin', '3' => 'lecturer', '2' => 'student');
            break;
    }
}

?>

<h1>Kiosk. Register</h1>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
    'id'=>'Users-models-form',
    // Please note: When you enable ajax validation, make sure the corresponding
    // controller action is handling ajax validation correctly.
    // There is a call to performAjaxValidation() commented in generated controller code.
    // See class documentation of CActiveForm for details on this.
    'enableAjaxValidation'=>false,
    'htmlOptions'=>array('enctype'=>'multipart/form-data')
)); ?>

    <p class="note">Fields with <span class="required">*</span> are required.</p>

    <?php echo $form->errorSummary($model); ?>

    <div class="row">
        <?php echo $form->labelEx($model,'Fname'); ?>
        <?php echo $form->textField($model,'Fname',array('size'=>60,'maxlength'=>500)); ?>
        <?php echo $form->error($model,'Fname'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'Lname'); ?>
        <?php echo $form->textField($model,'Lname',array('size'=>60,'maxlength'=>500)); ?>
        <?php echo $form->error($model,'Lname'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'email'); ?>
        <?php echo $form->textField($model,'email',array('size'=>60,'maxlength'=>500)); ?>
        <?php echo $form->error($model,'email'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'studentNumber'); ?>
        <?php echo $form->textField($model,'studentNumber',array('size'=>60,'maxlength'=>500)); ?>
        <?php echo $form->error($model,'studentNumber'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'PassWord'); ?>
        <?php echo $form->passwordField($model,'PassWord',array('size'=>60,'maxlength'=>1000)); ?>
        <?php echo $form->error($model,'PassWord'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'roles'); ?>
        <?php echo $form->dropDownList($model, 'roles', $roleArray, array('options' => array('Student'=>array('selected'=>true))));?>
        <?php echo $form->error($model,'roles'); ?>

    </div>

    <div class="row buttons">
        <?php echo CHtml::submitButton($model->isNewRecord ? 'Register' : 'Save'); ?>
    </div>

<?php $this->endWidget(); ?>

</div><!-- form -->

1 个答案:

答案 0 :(得分:0)

添加CSS

let Select = require('components/presentational-form/select');
let Text = require('components/presentational-form/select');
let CheckboxGroup = require('components/presentational-form/select');
let TestApp = React.createClass({
    render() {
        // Pretend the inputs array came from the server
        let inputs = [{...}, {...}, {...}];
        // Map over our inputs array in hopes of ending up with an array of input objects
        let inputComponents = inputs.map((input, index) => {    
            let ComponentToRender;
            let props;            

            if (input.type === 'select') {
                ComponentToRender = addInputValidation(Select);
                props = { labelText: input.label, options: input.options };
            } else if (input.type === 'text') {
                ComponentToRender = addInputValidation(Text);
                props = { labelText: input.label };
            } else if (input.type === 'checkbox') {
                ComponentToRender = addInputValidation(CheckboxGroup);
                props = { labelText: input.label, options: input.options };
            }

            let element = <ComponentToRender {...props} />;

            return element;
        })


        return (
            <div>
                <p>Enter some names:</p>
                {inputComponents}
            </div>
        );
    }
})