Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+7 votes
4.0k views
in Q2A Core by

Hi, 

i find this code HTML5 to Add an agree to terms & conditions checkbox. This is work for me 
 
  • Login and go to Administration
  • User
  • Custom message on register form - HTML allowed:
Add this code :
 
<form ... onsubmit="return checkForm(this);">
<p><input onchange="this.setCustomValidity(validity.valueMissing ? 'Please indicate that you accept the Terms and Conditions' : '');" id="field_terms" type="checkbox" required name="terms"> I accept the <u>Terms and Conditions</u></p></form> 
 
<script type="text/javascript"> document.getElementById("field_terms").setCustomValidity("Please indicate that you accept the Terms and Conditions"); </script>
 
you can change the blue text if you want
 
Maybe will be better to create a plugin, but i don't know how to do ;)
 
Cordially Claude
Q2A version: 1.6.3
by
I actually developed a plugin for this to check it field in server side instead of client side, but forgot to share :)
I'll add it in next few days. but this solution also works, I'll share it on qa-themes.com forum if it's not a problem for you.
by
No problem QA-Themes. Thanks for you feedback
by
Hey can you share the plugin link?
by
For version 1.6 of Q2A: https://github.com/Towhidn/Q2A-Terms-of-Service
In 1.7, Q2A have this option in the core (in Admin > Users)

2 Answers

+2 votes
by
I just published the plugin as promised:

https://github.com/Towhidn/Q2A-Terms-of-Service

it has both JavaScript and Server Side validation. if you had any problems let me know.
by
Hi QA-Themes,

Thank you very much for you help. i just try now and i get this error :

qa-include\qa-base.php(510) : eval()'d code on line 45
+1 vote
by

Is it possible to adapt this plugin to show a checkbox when users answer or comment to a question?
Q2A is not GDPR ready and it'll be great to really comply with some of the new law requirements like:

  • A check for private policy consent on contact form.
  • A check for private policy consent for not logged user on question, answer and comment forms if this option is allowed.
As requested by desgrapador
Thanks!
...