Commit 293cb9d8 by Qiang Xue

Fixed search form.

parent 65b8cc21
...@@ -23,7 +23,10 @@ use yii\widgets\ActiveForm; ...@@ -23,7 +23,10 @@ use yii\widgets\ActiveForm;
<div class="<?php echo Inflector::camel2id(StringHelper::basename($generator->modelClass)); ?>-search"> <div class="<?php echo Inflector::camel2id(StringHelper::basename($generator->modelClass)); ?>-search">
<?php echo '<?php'; ?> $form = ActiveForm::begin(array('method' => 'get')); ?> <?php echo '<?php'; ?> $form = ActiveForm::begin(array(
'action' => array('index'),
'method' => 'get',
)); ?>
<?php <?php
$count = 0; $count = 0;
......
...@@ -73,7 +73,7 @@ class DataColumn extends Column ...@@ -73,7 +73,7 @@ class DataColumn extends Column
* the [[filter]] property. When [[filter]] is not set or is an array, this property will be used to * the [[filter]] property. When [[filter]] is not set or is an array, this property will be used to
* render the HTML attributes for the generated filter input fields. * render the HTML attributes for the generated filter input fields.
*/ */
public $filterInputOptions = array('class' => 'form-control'); public $filterInputOptions = array('class' => 'form-control', 'id' => null);
protected function renderHeaderCellContent() protected function renderHeaderCellContent()
......
...@@ -237,7 +237,7 @@ class BaseHtml ...@@ -237,7 +237,7 @@ class BaseHtml
$hiddenInputs[] = static::hiddenInput($request->restVar, $method); $hiddenInputs[] = static::hiddenInput($request->restVar, $method);
$method = 'post'; $method = 'post';
} }
if ($request->enableCsrfValidation) { if ($request->enableCsrfValidation && !strcasecmp($method, 'post')) {
$hiddenInputs[] = static::hiddenInput($request->csrfVar, $request->getCsrfToken()); $hiddenInputs[] = static::hiddenInput($request->csrfVar, $request->getCsrfToken());
} }
} }
......
...@@ -77,6 +77,7 @@ class Request extends \yii\base\Request ...@@ -77,6 +77,7 @@ class Request extends \yii\base\Request
*/ */
const CSRF_HEADER = 'X-CSRF-Token'; const CSRF_HEADER = 'X-CSRF-Token';
/** /**
* @var boolean whether to enable CSRF (Cross-Site Request Forgery) validation. Defaults to true. * @var boolean whether to enable CSRF (Cross-Site Request Forgery) validation. Defaults to true.
* When CSRF validation is enabled, forms submitted to an Yii Web application must be originated * When CSRF validation is enabled, forms submitted to an Yii Web application must be originated
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment