How to add recaptcha to k2 smartform

  • 10 June 2019
  • 7 replies
  • 30 views

Hi All,

 

Can someone give some instructions to add recaptcha option to the form.

Note: i'm getting the blank screen after following the instructions which are there in the blog: https://www.k2.com/blog/adding-google-recaptcha-to-k2-process-automation-forms

 

is it something because of the K2 version(K2 Five(5.2)) which i'm running?

 

Regards

Srinivas Kondapalli


7 replies

Badge +9

Hi  SRI2

 

http://www.k2.com/blog/adding-google-recaptcha-to-k2-process-automation-forms

 

https://community.k2.com/t5/K2-Blackpearl-Forum-Posts/Adding-Captcha-capabilities-to-SmartForms/m-p/76740?nobounce=#M22337

 

Should you find the information from the article useful or leading you to the answer please mark as "Solution and/or Kudo", as it will assist other k2 developers with relevant information in the near future.

 

Best Regards

Elvis

 

[K2 will not accept any liability for any issues arising from actions taken in respect of the information provided by any forum member]

Badge +9

Hi

 

Adding on the post i recently posted 

 

Create a textbox control on the form or view and set its Name property to "txtReturnValue" and uncheck its Visible property.
2. Create a data label control on the form or view and set its Expression property to the following, replacing the sitekey attribute's value with your reCAPTCHA Google api site key:

<script type="text/javascript">var recaptchaCallback = function(response) {$('input[name="txtReturnValue"]').trigger("focus").val(response).trigger("blur");};</script><script src='https://www.google.com/recaptcha/api.js' ></script> <div class="g-recaptcha" data-sitekey="your-google-recaptcha-sitekey" data-callback="recaptchaCallback"></div>

3. Create one or more Changed Event rules on the txtReturnValue control to implement the logic that only allows the form from being submitted when the reCaptcha has been successfully processed. For example you could enable the Submit button which has is disabled by default.
4. In addition to or as an alternative, add conditions to any rules on form buttons controls to check the txtReturnValue control has a value. For example, only perform the desired actions on the Submit button when the txtReturnValue control has a value.

Google's api responds with a long string value when the user has successfully validated they are not a robot. What the value is that is put into the txtReturnValue textbox doesn't matter, just don't allow the users to access or view that control.

Please Note that this feature is NOT supported by K2.

 

Should you find the information from the article useful or leading you to the answer please mark as "Solution and/or Kudo", as it will assist other k2 developers with relevant information in the near future.

 

Best Regards

Elvis

 

[K2 will not accept any liability for any issues arising from actions taken in respect of the information provided by any forum member]

Good day  @Sri2;

 

if your successfully registered  on reCAPTCHA with google, 

I just followed you from (https://community.k2.com/t5/K2-Blackpearl-Forum-Posts/Preventing-spam-in-forms-ReCaptcha/td-p/97970) , Since you're on k2 5.2 I noticed your prevent xss property is checked .

Please also make use of this article to set up your js to work properly (https://dudelisdev.com/2018/11/how-add-javascript-on-smartforms.html

 

Thank you...

 

Should you find the above content useful kindly Mark such as "Accepted Solution and/or Kudo".

 

Regards;

Widson.

Hi Widson,

 

Thank you so much for your reply.

I unchecked the xss property, but no luck, still i'm getting the blank screen.

 

Regards

SK

Hi Elvis,

 

Thank you so much for your reply.

i tried all the options before i start the thread, but unfortunately none of the options didnt worked.

 

https://community.k2.com/t5/K2-Blackpearl-Forum-Posts/Preventing-spam-in-forms-ReCaptcha/td-p/97970

 

Regards

SK

 

 

Good day  @Sri2;

 

I have followed steps i mentioned earlier and i have following , and I'm not experiencing blank in my view/form:-

 

Hope it helps...

 

Great thanks!

 

Regards;

Widson.

Hi Sri2;

Please check out with the walk-through in this link regarding custom expression to emulate a Captcha validation(https://help.k2.com/onlinetraining/tutorials/default.htm#Resources/Projects/K2-Vignettes/SmartForm-Validations/Applying-Validations-to-SmartForms.htm) ,

Thank you,
Widson.

Reply