RobinHerbots / Inputmask

Input Mask plugin
https://robinherbots.github.io/Inputmask/
MIT License
6.4k stars 2.17k forks source link

Can't paste email #1718

Open stasbamiza opened 7 years ago

stasbamiza commented 7 years ago

After success ajax request I paste email into email field. Get email value like this: _odessajora@gmail.com Then use $(.email).val('odessa_jora@gmail.com') and got

odessajoragmailcom@

I expected got saved value _odessajora@gmail.com

$('.email').inputmask({
    mask: "*{1,20}[.*{1,20}][.*{1,20}][.*{1,20}]@*{1,20}[.*{2,6}][.*{1,2}]",
    greedy: false,
    onBeforePaste: function (pastedValue, opts) {
        pastedValue = pastedValue.toLowerCase();
        return pastedValue.replace("mailto:", "");
    },
    definitions: {
        '*': {
            validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~\-]",
            cardinality: 1,
            casing: "lower"
        }
    },
    clearMaskOnLostFocus: true
});
RobinHerbots commented 7 years ago

@stas0 ,

This works on the demo page. Why don't you use the email alias? Can you create a jsfiddle so it is easily verified.