form.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * This is the template for generating the form view for the specified model.
  4. * The following variables are available in this template:
  5. * - $modelClass: the model class name
  6. * - $attributes: a list of attribute names to receive form inputs
  7. */
  8. ?>
  9. <div class="form">
  10. <?php echo "<?php \$form=\$this->beginWidget('CActiveForm', array(
  11. 'id'=>'".$this->class2id($modelClass)."-form',
  12. 'enableAjaxValidation'=>false,
  13. )); ?>\n"; ?>
  14. <p class="note">Fields with <span class="required">*</span> are required.</p>
  15. <?php echo "<?php echo \$form->errorSummary(\$model); ?>\n"; ?>
  16. <?php
  17. foreach($attributes as $attribute)
  18. {
  19. ?>
  20. <div class="row">
  21. <?php echo "<?php echo \$form->labelEx(\$model,'$attribute'); ?>\n"; ?>
  22. <?php echo "<?php echo \$form->textField(\$model,'$attribute'); ?>\n"; ?>
  23. <?php echo "<?php echo \$form->error(\$model,'$attribute'); ?>\n"; ?>
  24. </div>
  25. <?php
  26. }
  27. ?>
  28. <div class="row buttons">
  29. <?php echo "<?php echo CHtml::submitButton('Submit'); ?>\n"; ?>
  30. </div>
  31. <?php echo "<?php \$this->endWidget(); ?>\n"; ?>
  32. </div><!-- form -->