Browse Source

Fixes #848: Added hidden field for Html::activeFileInput().

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
4e1ab6e5a5
  1. 5
      framework/yii/helpers/HtmlBase.php

5
framework/yii/helpers/HtmlBase.php

@ -1049,7 +1049,10 @@ class HtmlBase
*/ */
public static function activeFileInput($model, $attribute, $options = array()) public static function activeFileInput($model, $attribute, $options = array())
{ {
return static::activeInput('file', $model, $attribute, $options); // add a hidden field so that if a model only has a file field, we can
// still use isset($_POST[$modelClass]) to detect if the input is submitted
return static::activeHiddenInput($model, $attribute, array('id' => null, 'value' => ''))
. static::activeInput('file', $model, $attribute, $options);
} }
/** /**

Loading…
Cancel
Save