1

I have used bootsrap YII extension. It worked fine until on my localhost but, it did not work when I transfered to server. All I get is white screen. When I remove the form to generate the code, it works fine. Here is my code. I know the bootstrap is generating error but dont know which line.

    <?php
$form = $this->beginWidget('bootstrap.widgets.BootActiveForm', array(
    'id' => 'registration-form',
    'type' => 'horizontal',
    'enableAjaxValidation' => true,
    //'enableClientValidation'=>true,
    'clientOptions' => array(
        'validateOnSubmit' => true,
    )
        ));
?>
<?php echo $form->dropDownListRow($model, 'user_type', $model->getUserType(), array('class' => 'span4')); ?>
<?php echo $form->textFieldRow($model, 'user_id', array('class' => 'span4', 'placeholder' => 'Enter 6 digit pin which you can easily remember')); ?>
<?php echo $form->textFieldRow($model, 'username', array('class' => 'span4', 'placeholder' => 'Username')); ?>
<?php echo $form->passwordFieldRow($model, 'password_real', array('class' => 'span4', 'maxlength' => 30, 'placeholder' => 'Password')); ?>
<?php echo $form->passwordFieldRow($model, 'repeat_password', array('class' => 'span4', 'maxlength' => 30, 'placeholder' => 'Do not copy from above')); ?>
<?php echo $form->textFieldRow($model, 'firstname', array('class' => 'span4', 'placeholder' => 'Initial name')); ?>
<?php echo $form->textFieldRow($model, 'lastname', array('class' => 'span4', 'placeholder' => 'Family name')); ?>
<?php echo $form->textFieldRow($model, 'email', array('class' => 'span4', 'placeholder' => 'This will not be revealed')); ?>
<div class="control-group">
    <?php echo $form->labelEx($model, 'dob', array('class' => 'control-label')); ?>
    <div class="controls">
        <?php
        $this->widget('zii.widgets.jui.CJuiDatePicker', array(
            'model' => $model,
            'attribute' => 'dob',
            // additional javascript options for the date picker plugin
            'options' => array(
                //'showAnim'=>'fold',
                'changeMonth' => true,
                'changeYear' => true,
                'maxDate' => '-18y',
            ),
            'htmlOptions' => array(
                'class' => 'span4',
                'placeholder' => 'Choose from Date picker'
            ),
        ));
        ?></div>
    <?php echo $form->error($model, 'dob'); ?>
</div>
<?php echo $form->textFieldRow($model, 'profession', array('class' => 'span4', 'maxlength' => 255)); ?>

<?php echo $form->textFieldRow($model, 'hobby', array('class' => 'span4', 'maxlength' => 255, 'placeholder' => 'What you like most')); ?>
<div class="control-group" id="heightDiv">
    <?php echo $form->labelEx($model, 'height', array('class' => 'control-label')); ?>

    <div class="controls"><?php echo $form->textField($model, 'height', array('class' => 'span4', 'maxlength' => 20, 'placeholder' => 'Enter in CM')); ?> CM
        <?php echo $form->error($model, 'height'); ?></div>
</div>
<div class="control-group" id="weightDiv">
    <?php echo $form->labelEx($model, 'weight', array('class' => 'control-label')); ?>

    <div class="controls"><?php echo $form->textField($model, 'weight', array('class' => 'span4', 'maxlength' => 20, 'placeholder' => 'Enter in KG')); ?> KG
        <?php echo $form->error($model, 'weight'); ?></div>
</div>
<div class="control-group" id="weightTDiv">
    <?php echo $form::labelEx($model, 'weight_taken_on', array('class' => 'control-label')); ?>
    <div class="controls">

        <?php
        $this->widget('zii.widgets.jui.CJuiDatePicker', array(
            'model' => $model,
            'attribute' => 'weight_taken_on',
            // additional javascript options for the date picker plugin
            'options' => array(
                'showAnim' => 'fold',
                'changeMonth' => 'true',
                'changeYear' => 'true',
                'maxDate' => 'y',
            ),
            'htmlOptions' => array(
                'class' => 'span4',
                'placeholder' => 'Choose from Date picker'
            ),
        ));
        ?>
    </div>
</div>
<div class="line"></div>
<div class="control-group">
    <div class="controls">
        <?php
        $this->widget('bootstrap.widgets.BootButton', array(
            'buttonType' => 'submit',
            'type' => 'primary',
            'size' => 'large',
            'label' => $submit_btn,
        ));
        ?>
    </div>
</div>

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

1 回答 1

4

你的代码看起来不错,除了上面写着的那一行,

<?php echo $form::labelEx($model, 'weight_taken_on', array('class' => 'control-label')); ?>

将其替换为,

<?php echo $form->labelEx($model, 'weight_taken_on', array('class' => 'control-label')); ?>

它应该工作。

于 2013-10-26T08:58:34.970 回答