Example #1
0
 /**
  * @inheritDoc
  */
 public function error($model, $attribute, $htmlOptions = array(), $enableAjaxValidation = true, $enableClientValidation = true)
 {
     if (!$this->qualifyNames && !isset($htmlOptions['inputID'])) {
         $htmlOptions['inputID'] = \CHtml::getIdByName($attribute);
     }
     if (!isset($htmlOptions['itemerror'])) {
         $htmlOptions['itemerror'] = $attribute;
     }
     return parent::error($model, $attribute, $htmlOptions, $enableAjaxValidation, $enableClientValidation);
 }
Example #2
0
    /**
     * Formats a set of input field that consists of label, input, and error message.
     * @param  CActiveForm $form the form
     * @param  string $type the input field method
     * @param  CModel $model the model
     * @param  string $attribute the attribute
     * @param  string $icon the icon
     * @param  array $htmlOptions the HTML option values
     * @param  array $otherOptions otherOptions
     * @return string the HTML of the set of the input field
     */
    public function formatInputField($form, $type, $model, $attribute, $icon, $htmlOptions = array(), $otherOptions = array())
    {
        return '<tr>
				<td>
					<div class="control-group attribute-' . $attribute . '">
						<i class="icon ' . $icon . '"></i> ' . $form->labelEx($model, $attribute, array('class' => 'control-label')) . '
					</div>
				</td>
				<td>
					<div class="control-group attribute-' . $attribute . '">' . @$otherOptions['beforeInput'] . (isset($otherOptions['data']) ? $form->{$type}($model, $attribute, $otherOptions['data'], $htmlOptions) : $form->{$type}($model, $attribute, $htmlOptions)) . @$otherOptions['afterInput'] . (isset($otherOptions['hint']) ? '<span class="hint">' . $otherOptions['hint'] . '</span>' : '') . $form->error($model, $attribute, array('inputContainer' => '.attribute-' . $attribute)) . '
					</div>
				</td>
			</tr>';
    }
Example #3
0
 public function error($model, $attribute, $htmlOptions = array(), $enableAjaxValidation = true, $enableClientValidation = true)
 {
     return str_replace(array('div', 'errorMessage'), array('small', 'error'), parent::error($model, $attribute, $htmlOptions, $enableAjaxValidation, $enableClientValidation));
 }
Example #4
0
 /**
  * Error
  *
  * A wrapper for the error() method in the parent class, CActiveForm, to allow for form objects to be passed as
  * well as form models. It also disabled the client and AJAX validation by default.
  *
  * @access public
  * @param CForm|CModel $formModel
  * @param string $attribute
  * @param array $htmlOptions
  * @param boolean $enableAjaxValidation
  * @param boolean $enableClientValidation
  * @return string
  */
 public function error($formModel, $attribute, $htmlOptions = array(), $enableAjaxValidation = false, $enableClientValidation = false)
 {
     if ($formModel instanceof \CForm && isset($formModel->model) && $formModel->model instanceof \CModel) {
         $formModel = $formModel->model;
     }
     return parent::error($formModel, $attribute, $htmlOptions, $enableAjaxValidation, $enableClientValidation);
 }
Example #5
0
 public function error($model, $attribute, $htmlOptions = array(), $enableAjaxValidation = true, $enableClientValidation = true)
 {
     $html = '<br class="error-breaker">' . parent::error($model, $attribute, $htmlOptions, $enableAjaxValidation, $enableClientValidation);
     return $html;
 }
Example #6
0
 /**
  * Displays the first validation error for a model attribute.
  * This is similar to {@link CHtml::error} except that it registers the model attribute
  * so that if its value is changed by users, an AJAX validation may be triggered.
  * @param CModel $parentModel the parent data model
  * @param string $attributedPath the attribute name
  * @param array $htmlOptions additional HTML attributes to be rendered in the container div tag.
  * @param boolean $enableAjaxValidation whether to enable AJAX validation for the specified attribute.
  * @param boolean $enableClientValidation whether to enable client-side validation for the specified attribute.
  * @return string the validation result (error display or success message).
  * @see CHtml::error
  */
 public function error($parentModel, $attributedPath, $htmlOptions = array(), $enableAjaxValidation = true, $enableClientValidation = true)
 {
     list($model, $attribute, $htmlOptions) = self::resolveArgs($parentModel, $attributedPath, $htmlOptions);
     return parent::error($model, $attribute, $htmlOptions, $enableAjaxValidation, $enableClientValidation);
 }
        echo $form->hiddenField($model, "[{$i}]id");
        ?>
            <?php 
    }
    ?>
            <?php 
    echo $form->hiddenField($model, "[{$i}]type");
    ?>
            <?php 
    echo $form->labelEx($model, "[{$i}]text");
    ?>
            <?php 
    echo $form->textArea($model, "[{$i}]text", array("rows" => 6, "cols" => 50, 'class' => 'required'));
    ?>
            <?php 
    echo $form->error($model, "[{$i}]text");
    ?>
        </div>

        <div class="field">
            <?php 
    echo $form->labelEx($model, "[{$i}]percent");
    ?>
            <?php 
    echo $form->textField($model, "[{$i}]percent", array("size" => 10, "maxlength" => 10, 'class' => 'range(1,100)'));
    ?>
            <?php 
    echo $form->error($model, "[{$i}]percent");
    ?>
        </div>