Skip to main content

Hi,

 

I'm interested in using a ReCaptcha type element to a form in order to prevent spam, has anyone here managed to encorporate this type of security steps in a k2 Form? i.e. ReCaptcha, Solve a maths question, identify an item for example?

 

I'm on v4.7 blackpearl, so would appreciate any help in how this can be used in a form and how the process would work?

 

Thanks

Just bumping this thread.

 

Any ideas?


It looks like you may be able to add this reCaptcha functionality to a SmarForms:


* requires a Google Account 


 


https://www.a2hosting.com/blog/implement-captcha-solution-website/


 


Step #1: Register Your Website on reCAPTCHA 



 


*  looks like you just need a Label and the applicable domain



 


Add a literal [data label1] with expression and the recaptcha script:



 


On another literal [data label2], add the div that would have the captcha



 


 


The same information is avalable at:



 


 


I am not yet sure of to validate via server side, but from client side I used the information from:


https://stackoverflow.com/questions/27902539/how-can-i-validate-google-recaptcha-v2-using-javascript-jquery


http://community.k2.com/t5/K2-blackpearl/SmartForms-How-to-execute-JavaScript-via-rules/ta-p/90846


 


Adding another literal [data label3] and mapping this to the button click event that would submit stuff:



 


As per the kb article above, the first data transfer just transfers an blank value to clear, and the second would would transfer the client side check:



 


If I submit without the captcha completed:



 


Captcha:



 


If I submit with captcha filled out:



 


Perhaps instead of alert, a value can be set on another data label (hidden) and then a condition can be used to check this before submitting or not submitting.


Hi Sharpharp1,


 


Adding to 


 


 



 




 


 


 



<script type="text/javascript">
var correctCaptcha = function(response) {
$("[name='dlResponse']").SFCLabel('option', 'text', 'Good');
};
</script>


 


data-callback="correctCaptcha">


 



Hi all,

 

Thanks for the replies.

 

@tin - I set your solution up, can i ask if you could post a screen grab of that first transfer action.

 

I can get the recaptcha to appear, but when clicking on a square, it fades out white and the recaptcha loads a different pic. I ended up refreshing and the same happens. Eventually the ticked squared stayed, but more often than not it's just fading and loading a new box....

 

@mustafa - How is your solution different? Can you do a step by step? - Are you adding two extra data labels to tins solution, or is this a different way altogether?


Hi Sharpharp1,


 


This is how its designed, there are 2 different versions or reCAPTCHA, one that you can select multiple images at a time and the other one for example when it asks you to select images that has car or road, this will require more than one image to be selecte and when you select one image it will be submited and the grid will refresh or show another image until all the required images are selected then you can verify it.


 


my solution is the same as tin's soluton, the only difference is when you verify the reCAPTCHA, the response will be transferred to a data label without clicking a button, just skipping the button click to validate the response.


 


 


Thanks for the explanation Mustafa,

 

I got both versions working, thanks to both you and Tin for the help, i'm sure this will come in useful for others as well.

 

I've used your auto response combined with a "if the data label is changed" rule to then move onto processing the next stages such as workflows etc.

 

Nice one !!!

 

 


Hi,

 

I followed the instructions till adding the datalable-2(On another literal [data label2], add the div that would have the captcha) and run the view, but captcha is not displaying, view is total blank(refer screenshot-5).

Note: Java script is enabled in my browser.

Screenshot1:

 

 

Do i need to make any other changes?

 

Regrads

SK

 

 


Reply