contact.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. use yii\helpers\Html;
  3. use yii\widgets\ActiveForm;
  4. use yii\widgets\Captcha;
  5. /**
  6. * @var yii\base\View $this
  7. * @var yii\widgets\ActiveForm $form
  8. * @var app\models\ContactForm $model
  9. */
  10. $this->title = 'Contact';
  11. $this->params['breadcrumbs'][] = $this->title;
  12. ?>
  13. <h1><?php echo Html::encode($this->title); ?></h1>
  14. <?php if (Yii::$app->session->hasFlash('contactFormSubmitted')): ?>
  15. <div class="alert alert-success">
  16. Thank you for contacting us. We will respond to you as soon as possible.
  17. </div>
  18. <?php return; endif; ?>
  19. <p>
  20. If you have business inquiries or other questions, please fill out the following form to contact us. Thank you.
  21. </p>
  22. <?php $form = ActiveForm::begin(array(
  23. 'options' => array('class' => 'form-horizontal'),
  24. 'fieldConfig' => array('inputOptions' => array('class' => 'input-xlarge')),
  25. )); ?>
  26. <?php echo $form->field($model, 'name')->textInput(); ?>
  27. <?php echo $form->field($model, 'email')->textInput(); ?>
  28. <?php echo $form->field($model, 'subject')->textInput(); ?>
  29. <?php echo $form->field($model, 'body')->textArea(array('rows' => 6)); ?>
  30. <?php
  31. $field = $form->field($model, 'verifyCode');
  32. echo $field->begin()
  33. . $field->label()
  34. . Captcha::widget()
  35. . Html::activeTextInput($model, 'verifyCode', array('class' => 'input-medium'))
  36. . $field->error()
  37. . $field->end();
  38. ?>
  39. <div class="form-actions">
  40. <?php echo Html::submitButton('Submit', null, null, array('class' => 'btn btn-primary')); ?>
  41. </div>
  42. <?php ActiveForm::end(); ?>