2013-10-26 43 views
1

我已經使用bootsrap YII擴展。它工作正常,直到我的本地主機,但它沒有工作時,我轉移到服務器。我得到的只是白色屏幕。當我刪除表單來生成代碼時,它工作正常。這是我的代碼。我知道bootstrap會產生錯誤,但不知道哪一行。使用yii bootstrap擴展後,我得到白色屏幕,不知道爲什麼?

<?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(); ?> 
+0

是否打開了錯誤報告? – tinybyte

回答

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')); ?> 

它應該工作。

+1

謝謝,它確實有效。這是很棒的幫助。 – user2555652

+0

這是血腥的斑點,很好的捕獲 –

相關問題