primefaces-extensions / primefaces-extensions.github.com

Organization repo, only for homepage, wiki and issue tracker
https://primefaces-extensions.github.io/
68 stars 22 forks source link

CreditCard: Card image lost after validation not passed #791

Closed aripddev closed 4 years ago

aripddev commented 4 years ago

Card image has been lost after validation not passed any form items. Below is the picture of before and after form submission.

Screen Shot 2020-04-29 at 20 22 44
melloware commented 4 years ago

Fixed with commit: https://github.com/primefaces-extensions/core/commit/ca45110c43737823e0573caeeae4083ce8b7961c

If you need this fix now here is a MonkeyPatch you can add to your JS file that fixes it.

PrimeFaces.widget.ExtCreditCard.prototype.refresh = function(cfg) {
    PrimeFaces.widget.BaseWidget.prototype.refresh.call(this, cfg);

    $(document).ready(function() {
        const blur = new Event('blur');
        const change = new Event('change');
        $('.ui-state-filled').each(function(index) {
            this.dispatchEvent(blur);
            this.dispatchEvent(change);
        })
    });
};