Closed varkao closed 1 year ago
Hi @GAMY-lib, sorry for the (really) late reply. Currently, there is no public function available to reset the captchas on a page with. For now, you can use the following code snippet to reset your captchas. It extends the IconCaptcha script with a new function, which will later be properly implemented into the source code.
The snippet can be placed anywhere (after the script file was loaded), but right before initializing a captcha seems like the best place to put it. To use it, simply call IconCaptcha.reset()
and it will clear your captchas. Note that this will clear/reset every captcha on the page. It's kind of duplicated code (cause of the copied options), but there is no other way right now. Hope this helps!
IconCaptcha.reset = function() {
this.nodes = null;
this.init('.iconcaptcha-holder', {
general: { // your form options, same as when you initiated the captcha.
validationPath: '../src/captcha-request.php',
fontFamily: 'Poppins',
credits: 'show',
},
... // remaining options
})
}
Hi @GAMY-lib! Just letting you know that the reset function is now available in release version 3.1.0. The Wiki will be updated shortly to include more information about the function.
Hello, there is a way to reload or reset the captcha once the verification is completed (without refresh the page) I'm using an ajax form, and my problem is that when the client receives a false message, I merely need to refresh the captcha to allow the client to make another request.