Howto adjust client side email validation

When a user signs up with a mobile phone,

An invalid e-mail, warning will be shown.

An extra space is being added when a user is typing his/her e-mail and then selecting the typed ahead e-mail.

How can I adjust the client side e-mail validation, that it will trim the value first, before client side validation.

Or how and where, can I override de default E-mail validator and what should the regex look like?

On Server side this is handeld bij de trim rule…

here are my email rules


   public function rules() {

        return [

//...

    ['email', 'filter', 'filter' => 'trim'],

    ['email', 'required'],

    ['email', 'email'],

    ['email', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This email is allready in use'],

//...

}

Is there a way to override vendor\yiisoft\yii2\assets\yii.validation.js with this code.

Now I’ve adjusted yii.validation.js directly but with a next update it can be gone.


email: function (value, messages, options) {

             if (options.skipOnEmpty && pub.isEmpty(value)) {

                 return;

             }


			//error find! value not trimmed.

			//Add trim to prevent error with space after email - AGK 2015-06-20

			value = value.trim();

			//

            

             var valid = true;

 

             if (options.enableIDN) {