R0CKY Posted January 3, 2017 Share Posted January 3, 2017 (edited) Hi Im hoping I can get some help with this - as it is a big problem for me. I am trying to add googles recaptcha code to my existing php page with a comment form... This is the code I have to place before the submit button <buttonclass="g-recaptcha" data-sitekey="---deleted----" data-callback="YourOnSubmitFn"> Submit </button> And This is my current form code from a php file (I've stripped out table layout tags for clarity) <form action="{$settings.dburl}/index.php?act=comments&c=post&file={$file.file_id}" method="post"> {#post_comment#} {#poster# <input type="text" name="subject" id="subject" size="40" maxlength="150" /> <textarea name="comment" id="comment" rows="12" style="width: 95%"></textarea> <input type="submit" value="{#post_comment#}" onclick="postComment({$file.file_id}); return false;" /> </form> I am confused about what I should replace the YourOnSubmitFn with? Any help would be greatly appreciated. Edited January 3, 2017 by R0CKY Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted January 4, 2017 Share Posted January 4, 2017 Have you read the documentation? The callback must be a JavaScript function which is called when the user tries to solve the CAPTCHA and has a single parameter for the user's response (g-recaptcha-response). This response must be sent to the server along with the actual form data and then verified. Your system for form submission is rather strange, though, so I cannot comment on how to actually implement the function. Quote Link to comment Share on other sites More sharing options...
R0CKY Posted January 4, 2017 Author Share Posted January 4, 2017 This is the difficulty I have, I have no php or javascript experience and as you have spotted, I am using a rather old script. I usually muddle through with trial and error, however I am struggling now. I'll figure it out though. Thanks for the pointers. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.