Tagged: alert, enfold, javascript
Hi ,
I ran into a slight issue with the latest version of Enfold 4.5.4
I have custom javascript code which runs only in admin – this alerts the client on creating a custom-post-type new post, that they need to select a Category before publishing.
Previously a standard javascript alert would handle this function.
alert(‘Please select a Category.’);
if ($body.hasClass ('post-type-custom') && $body.hasClass ('post-new-php') || $body.hasClass ('post-type-custom') && $body.hasClass ('post-php')) {
$('#post').on('submit', function (e) {
if ($('#custom-catchecklist').find('input:checked').length < 1) {
alert('Please select a Category.');
return false;
}
return true;
});
}
For some reason all JS alerts stopped working in ENFOLD 4.5.4
I had my developers look into the issue. and we found that
enfold/framework/js/avia_recaptcha.js
LINE 1
var alert = [];
Converts all JS alerts to an array.
This is overriding default javascript functionality.
The only solution I could find was to replace
alert('Please select a Category.');
with
$('body').avia_alert({the_class:'error', show:6500 , text:'Please select a Category.'});
But HEY! I shouldn’t need to do this right!
Hey HuxburyQuinn,
Sorry for the late reply, I took a look at the latest version of avia_recaptcha.js on GitHub and quite a lot of it has been rewritten, it is now “var alert = null;”
So I believe you will not have this issue in the next version.
I don’t know when it’s being released, but I saw a post to another customer from the dev team that it will be very soon.
I suggest that we leave this thread open and ask you to report back with your results from the new version.
Is this reasonable?
Best regards,
Mike