Answer the question
In order to leave comments, you need to log in
Why Yii2 Captcha doesn't see Action in module?
So. All actions take place on the Yii2 framework in the feedback module
Routing:
public $urlRules = [
'prefix' => 'feedback',
'routePrefix' => 'feedback',
'rules' => [
'send' => 'send',
'captcha' => 'default/captcha',
],
];
class DefaultController extends Controller
{
public function actions()
{
return [
'captcha' => [
'class' => 'yii\captcha\CaptchaAction',
//'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
],
];
}
}
...
public function rules()
{
...
$rules[] = [$field, 'captcha', 'captchaAction'=>'/feedback/captcha'];
...
}
...
...
echo $form->field($this, $field)->widget(Captcha::className([
'captchaAction' => '/feedback/captcha'
]));
...
Exception (Invalid Configuration) 'yii\base\InvalidConfigException' with message 'Invalid CAPTCHA action ID: /feedback/captcha'
$rules[] = [$field, 'captcha', 'captchaAction'=>'/feedback/default/captcha'];
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question