0

I'm struggling to make reCAPTCHA work in my Orbeon form. I'm using ORBEON 2018.2.3.201905172253 PE within SAP Commerce (Hybris). After submitting the form, I get the error "Please check your answer to the CAPTCHA challenge" even though the captcha is correct.

Created a common Form and added reCAPTCHA as per official Orbeon documentation: https://doc.orbeon.com/form-runner/component/captcha

  • Added my private and public keys to the properties file
  • Added the reCAPTCHA property to my form:
<property
        as="xs:string"
        name="oxf.fr.detail.captcha.yforms.myForm"
        value="reCAPTCHA"/>
  • This is the process executed when clicking the SUBMIT button:
    <property as="xs:string"  name="oxf.fr.detail.process.save-final.yforms.myForm">
        validate-all
        then save
        then send(
        uri        = "https://myurl",
        method     = "PUT"
        )
        then navigate(uri = "https://myurl")
    </property>
  • I see the reCAPTCHA at the bottom of my form as expected
  • When I click SUBMIT after filling up the form and completing the captcha successfully, I see a popup saying "There are validation errors. Please retry once all fields have been properly filled-out." And the form displays this error for the captcha field: "Please check your answer to the CAPTCHA challenge."

So I'm clearly missing something. I know there are some configurations needed for the fr-verify-done and fr-verify-error to be added, but the Orbeon documentation does not specify how to configure those through PROPERTIES. They only say how to add those event listeners while adding the captcha component by hand (editing the source code of the form through Form Builder).

Things that I tried and didn't work:

  1. Dispatching an fr-verify event when submitting:

    xf:dispatch(name = "fr-verify", targetid = "captcha") then validate-all then save then send( uri = "https://myurl", method = "PUT" ) then navigate(uri = "https://myurl")

  2. Adding the reCAPTCHA component to the form source code as per Orbeon documentation:

<fr:recaptcha id="my-captcha">
<xf:send ev:event="fr-verify-done" submission="save-submission"/>
<xf:action ev:event="fr-verify-error">
<xf:toggle case="failure-case"/>
<xf:dispatch target="my-captcha" name="fr-reload"/>
</xf:action>
</fr:recaptcha>

When I click SAVE after adding the excerpt above, the Form Builder crashes. Same happens if I try to add the same excerpt to a form through the online demo form builder provided by Orbeon : https://demo.orbeon.com/demo/fr/orbeon/builder/new That is super weird since I'm adding code provided by them using the online last version of the form builder, and it still crashes when trying to save it. So that makes me think the problem I have is not related to my platform, but with Orbeon itself.

This is the error I get in the online demo for Form Builder after adding the recaptcha excerpt to the source code of the form: "Cannot read property 'call' of undefined'

There're no relevant LOGS that I can provide, I activated debug level logs for Orbeon and I'm not getting any useful info.

I would really appreciate if someone can guide me through with either: - Configuring the fr-verify events without changing the source code of the form using Form Builder, OR - Adding the reCAPTCHA component through Form Builder successfully without making it crash, OR - Anything you can come up with to make my form with captcha work

Thanks in advance, David

12
  • I've tried to reproduce this by downloading and installing a 2018.2.3, setting the property <property as="xs:string" name="oxf.fr.detail.captcha.yforms.myForm" value="reCAPTCHA"/>, along with public and private key properties, creating a new yforms/myForm form, hitting publish, and opening the new page. There, the captcha shows, with the "I'm not a robot" checkbox. After I check the checkbox, and recognize cars (how fun!), I can successfully save the form. Could you try following the same steps, and check if it works for you as well in that case?
    – avernet
    Jul 20, 2019 at 5:48
  • Also, thank you for the detailed question, and the investigation you already did! And since you're creating forms in Form Builder, and thus using Form Runner, you don't need to add the reCAPTCHA (<fr:recaptcha>) manually to the form, or deal with fr-verify or other events. ‑Alex
    – avernet
    Jul 20, 2019 at 5:51
  • Thanks for the answer Alex. If it works in Orbeon OOTB without further configuration I guess it's an integration problem with SAP Hybris then. It's odd though that even activating all Orbeon logs I still don't see any errors. Any ideas about how can I see captcha-related logs and/or debug the recaptcha flow? Thanks again
    – David Levy
    Jul 21, 2019 at 22:13
  • David, then this might be a tricky one to debug. Do you know what version of Orbeon Forms the version of SAP Hybris you have is using? I'm asking, since, as a first step, we should check this is 2018.1 or 2017.2.2 or newer, as previous versions of Orbeon Forms were using the reCAPTCHA 1, which Google doesn't support anymore (i.e. it isn't working). ‑Alex
    – avernet
    Jul 23, 2019 at 20:51
  • Yes. I'm using Hybris 6.6. OOTB, this hybris version uses orbeon 2017.1.1, which as you said uses captcha 1.1 which is no longer supported by google. After realizing this I upgraded the orbeon version to the last one downloading ORBEON 2018.2.3 and installing the war on top of hybris. I'm able to see and use the captcha, it's just not dispaching the "fr-verify-done" event for some reason
    – David Levy
    Jul 23, 2019 at 21:55

1 Answer 1

0

SAP Hybris 6.6 includes Orbeon Forms 2017.1.1, which uses Google's reCAPTCHA 1, which Google doesn't support anymore. Your options are either:

  • To upgrade to a version of SAP Hybris that includes Orbeon Forms 2018.1 or 2017.2.2 or newer (those version use Google's reCAPTCHA 2).
  • To use the SimpleCaptcha instead of reCAPTCHA.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.