ソースを参照

Refactored the widget usage with ActiveField.

Qiang Xue 12 年 前
コミット
1b94eff5d8
1 ファイル変更3 行追加9 行削除
  1. 3 9
      views/site/contact.php

+ 3 - 9
views/site/contact.php

@@ -31,15 +31,9 @@ $this->params['breadcrumbs'][] = $this->title;
 	<?php echo $form->field($model, 'email')->textInput(); ?>
 	<?php echo $form->field($model, 'subject')->textInput(); ?>
 	<?php echo $form->field($model, 'body')->textArea(array('rows' => 6)); ?>
-	<?php
-		$field = $form->field($model, 'verifyCode');
-		echo $field->begin()
-			. $field->label()
-			. Captcha::widget()
-			. Html::activeTextInput($model, 'verifyCode', array('class' => 'input-medium'))
-			. $field->error()
-			. $field->end();
-	?>
+	<?php echo $form->field($model, 'verifyCode')->widget(Captcha::className(), array(
+		'options' => array('class' => 'input-medium'),
+	)); ?>
 	<div class="form-actions">
 		<?php echo Html::submitButton('Submit', null, null, array('class' => 'btn btn-primary')); ?>
 	</div>