Recaptcha Throwing Console Error On Form Reset When Not In Use

Wappler Version : 3.9.7
Operating System : W10
Server Model: NodeJS (SPA)

Expected behavior

On resetting a form, there should be no recaptcha code excuting, if the form does not contain recaptcha.

Actual behavior

Keep getting this error everytime a form rest is called: form1.reset()
image

I have added recaptcha to the project (main layout) but its not being used in every single form in my app. So, every form that does not have recaptcha, I get this error in console on its reset.

I found some code in form.js which is the cause of this issue.

onreset: function(event) {
        dmx.validateReset(this.$node);
        if (window.grecaptcha) {
            grecaptcha.reset();
        }
        dmx.requestUpdate();
    }

Please share a fix.

What exactly did you add to the layout page? The recaptcha js include or something else?

Actually I added Recaptcha component in one of the content pages - which automatically added recaptcha JS in the main layout page.
Nothing else. No custom stuff.

1 Like

The condition checks if recaptcha is on the page, but it should probably also check if it is used in the form. Will try to improve that.

1 Like

@patrick Is there a file you could share for this please?

dmxAppConnect.zip (24.1 KB)

1 Like

Fixed in Wappler 4 beta 8

This topic was automatically closed after 46 hours. New replies are no longer allowed.