11 if (is_array($this->focus)) {
12 $this->focus =
"#".CHtml::activeId($this->focus[0], $this->focus[1]);
15 echo CHtml::endForm();
16 $cs = Yii::app()->clientScript;
17 if (!$this->enableAjaxValidation && !$this->enableClientValidation || empty($this->attributes)) {
18 if ($this->focus !== null) {
19 $cs->registerCoreScript(
'jquery');
20 $cs->registerScript(
'CActiveForm#focus',
"
21 if(!window.location.hash)
22 $('".$this->focus.
"').focus();
29 $options = $this->clientOptions;
30 if (isset($this->clientOptions[
'validationUrl']) && is_array($this->clientOptions[
'validationUrl'])) {
31 $options[
'validationUrl'] = CHtml::normalizeUrl($this->clientOptions[
'validationUrl']);
34 $options[
'attributes'] = array();
35 foreach ($this->attributes as $attr => $item) {
36 if (in_array($attr, $this->disableAjaxValidationAttributes) ===
false) {
37 array_push($options[
'attributes'], $item);
41 if ($this->summaryID !== null) {
42 $options[
'summaryID'] = $this->summaryID;
45 if ($this->focus !== null) {
46 $options[
'focus'] = $this->focus;
49 $options = CJavaScript::encode($options);
50 $cs->registerCoreScript(
'yiiactiveform');
52 $cs->registerScript(__CLASS__.
'#'.$id,
"\$('#$id').yiiactiveform($options);");