Closed sovetski closed 5 years ago
The captcha should automatically refresh after a few seconds when it receives an error from the backend during initialization. Additionally, you can listenen to the 'error.iconCaptcha' event and perform actions when it's fired.
The captcha refresh automatically when it receives an error from only if user selected the bad image.. How i can refresh captcha like google recaptcha ? ( for exemple in google recaptcha the code is : grecaptcha.reset(); https://stackoverflow.com/questions/3371314/how-to-reload-recaptcha-using-javascript )
Sorry for the late response. Right now, it is not possible manually refresh the captcha. However, as there is a 'resetCaptcha' function present in the JS file (see https://github.com/fabianwennink/IconCaptcha-Plugin-Front-End/blob/master/src/js/icon-captcha.js#L259) - which does exactly what you want - you can modify the code and make the function accessible from outside of the plugin. Currently I don't have time to do it myself, but I'll add it in the near future.
Hi, i have modified your file, if you want you can publish this file for other users who have the same problem.
For that, go to line 259 : https://github.com/fabianwennink/IconCaptcha-Plugin-Front-End/blob/master/src/js/icon-captcha.js#L259 and add this code after resetCaptcha(); function
` /**
Refresh the captcha and rebuild it. */
$.fn.iconCaptcha.refreshCaptcha = function refreshCaptcha() {
resetCaptcha();
}`
for use that :
$('.captcha-holder').iconCaptcha.refreshCaptcha();
Hello how I can refresh the captcha on front page once I give an error in PHP ?