Google recaptcha validation in yii2 always fails -


i use himiklab/yii2-recaptcha-widget. validation error when submit form.

{"captcha":["the verification code incorrect."]}. 

form:

$form->field($model, 'captcha',['template' => "{input}\n{hint}\n{error}"])->widget(             \himiklab\yii2\recaptcha\recaptcha::classname(),             [             'sitekey' => <mysitekey>,             'widgetoptions' => ['id'=>'recaptcha1']             ])  

controller:

if(isset($_post['contact'])){             if ($model->load(yii::$app->request->post()) && $model->save()) { 

what doing wrong?

the problem yii run validation twice, on validation() method , during save executes again validation, cause first validation successful second returns error. so, second case need save without running validations, save(false).

the second chance might unhook validation of captcha before safe() method.


Comments

Popular posts from this blog

Lists in Python -

android - can not access to progress bar in an other activity -

java - Vaadin 7 Pass Data Between Views -