• Resolved jatinder38

    (@jatinder38)


    Hello,

    I am facing an issue in placing the captcha on the form using the DYNAMICS 365 / CRM WORDPRESS PLUGIN, I have placed the captcha site key and Secret key, checked the Enable reCAPTCHA checkbox and also set the twig captcha parameter to true as shown below.

    [msdyncrm_twig]
    {% form entity=”lead” name=”Contact Us Personal Web Form” mode=”create” captcha=”true” default={“av_connectwithusflag”:”772350000″,”subject”: “Online Inquiry”,”av_potential”:”772350004″} %} {% endform %}
    [/msdyncrm_twig]

    Could anyone please provide support to resolve this issue.
    Thanking in advance.

Viewing 1 replies (of 1 total)
  • Plugin Author alexacrm

    (@alexacrm)

    Hi @jatinder38

    we do not support recaptcha as a property of the twig {% form %} object. However, it’s not difficult to add. Ensure that plugin is version 1.2.28.

    A new filter is exposed — wpcrm/twig/form/validate. It allows to filter the default validation result. A filter handler received validation result, map of form field values and the form Model object.

    add_filter( 'wpcrm/twig/form/validate', function( $result, $fields, $form ) {????
        return $result;
    }???????????, 10, 3 );

    $result contains a map with a couple of keys:
    status — (boolean) whether the submission is valid and values can be committed to CRM
    payload — (AttributeName -> string[]) Map of array strings with errors per field. The field does not need to be a valid attribute name.

    Validate email example

    add_filter( 'wpcrm/twig/form/validate', function( $result, $fields, $form ) {??????
        $email = $fields['emailaddress1'];
        if ( stripos( $email, '@example.com' ) !== false ) {?????
            return $result; // Alles ist gut.
        }?????
        
        $result['status'] = false;
        $result['payload']['emailaddress1'] = [ 'Must belong to the @example.com domain.' ];
        
        return $result;
    }??????, 10, 3 );

    reCAPTCHA

    1. Add reCAPTCHA to the form. See recaptcha docs
    2. $fields will contain reCAPTCHA token in g-recaptcha-response.
    3. Add validation filter similar to the one for email, use the official library to validate the token.
Viewing 1 replies (of 1 total)
  • The topic ‘reCaptcha not working’ is closed to new replies.