1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Salesforce Web to Lead and reCaptcha

Discussion in 'HTML, Graphics & Programming' started by Irish_Tom, Oct 3, 2019.

  1. Irish_Tom

    Capodecina

    Joined: Oct 18, 2002

    Posts: 12,170

    Hi all,

    Does anyone have any experience with Salesforce Web to Lead? I'm setting up a form and I've run into an odd issue.

    The form uses reCaptcha and the code is generated in the Salesforce backend.

    If I fill in all of the required fields, tick the 'I'm not a Robot' reCaptcha and click submit, everything works as expected, I'm redirected to my success page and I get a new lead in Salesforce. Great.

    If I fill in all of the fields, don't tick the reCaptcha but click submit, I'm taken to my success page anyway and, obviously, I don't get a new lead in Salesforce. Not great UX.

    It seems bizarre that Salesforce doesn't include validation of the reCaptcha (like it does with other required fields) before allowing you to click submit.

    I followed this tutorial which disables the submit button until the reCaptcha validates but then, even though everything seemed to submit successfully, the lead was never actually generated in Salesforce.

    Anyone got any bright ideas?

    Thanks for any help you can give me.
     
  2. mrbell1984

    Capodecina

    Joined: Aug 9, 2008

    Posts: 20,948

    Location: 127.0.0.1

    Does it work without the capture? I used to administrate sales force and I did have to implement web to lead but I never come across any issues with that.
     
  3. Irish_Tom

    Capodecina

    Joined: Oct 18, 2002

    Posts: 12,170

    Yep, all works fine without captcha.

    I’ve actually solved it, although it’s a bit of an odd solution.

    If I make the captcha ‘required’ in the source HTML it doesn’t seem to do anything but if I use jQuery to add ‘required’ when it identifies a div with
    #g-recaptcha then it seems to work with standard HTML5 validation…

    Strange but at least I seem to have cracked it.
     
  4. mrbell1984

    Capodecina

    Joined: Aug 9, 2008

    Posts: 20,948

    Location: 127.0.0.1

    ai that is coding for you. At least it's resolved.