Blank password field after ajax validate


I have an ActiveForm with Ajax Validation. The method returns a JSON string with errors using the standard Yii 2 Ajax Validation method.

How can I make my password field blank after the validation so if the user gets his / her username and password wrong it makes the password field null.

I have tried JQuery, but then it does not submit the password at all, as it blanks it before it submits it.

Any ideas?


maybe something like this will do to the trick


  setTimeout(function() {




it has a delay for chrome but i haven’t tested it.

what jquery code have you used/tried?

show your code.


I have tried various JQuery code, but none with a timeout which would probably work.

However I am asking is there a way to do this with Yii and not JQuery?


Not that i know of. If yii did it; it would still be jquery as it’s a client side action.

Ok thanks.