Blank password field after ajax validate

Hi,

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?

James.

maybe something like this will do to the trick




$('#login-form').submit(function(){

  setTimeout(function() {

	$("#login-password").val('');

  },100);

});



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

what jquery code have you used/tried?

show your code.

Hi,

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?

James.

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

Ok thanks.