• I have searched everywhere. I would like to ad a check box saying I have read the terms and conditions under the Comments that people will have to check before they can post.I have found plugins that just add terms and conditions under the comments but I would like them to have to check a box before a post can be made.

    Any ideas or know of something i can use?

    Cheers!

    Ben

Viewing 6 replies - 1 through 6 (of 6 total)
  • Something like this would work, and it’s a very simple script.

    https://lab.artlung.com/validate-checkbox/

    Does that help?

    Thread Starter bencurious

    (@bencurious)

    Hi that looks like it should work, although I am not sure how to apply this to my php file for the comments in my wordpress…?

    You just need to change the target’s name…

    Take this example element.

    <input type="CHECKBOX" name="CHECKBOX_1" value="This...">

    In this case the target name is CHECKBOX_1 which is then reflected in the Javascript.

    You just need to find out the name (name="example") for your checkbox and update the Javascript to reflect that.

    You’ll need to place the Javascript in between the <head> tags in your header.php

    Here’s an example (you’d need to change where i’ve put “NAME-HERE”)

    <script type="text/javascript" language="JavaScript">
    <!--
    function checkCheckBoxes(theForm) {
    	if (
    	theForm.NAME-HERE.checked == false)
    	{
    		alert ('You didn\'t choose any of the checkboxes!');
    		return false;
    	} else {
    		return true;
    	}
    }
    //-->
    </script>

    And also add onsubmit="return checkCheckBoxes(this);" onto the comments form.. (comments.php in your theme – same file you’ve proberly added your checkbox to).

    It’s untested, but it should be that easy (i can’t see why not)….

    ??

    Thread Starter bencurious

    (@bencurious)

    Thank you so much for your reply! It took me a little while to get it sorted because I forgot to put onsubmit=”return checkCheckBoxes(this);” in the comments form! But now it is working a dream! ?? ??

    I hope other people find this post and use the info in it! Thanks a lot t31os_

    Ben

    You’re welcome.. ??

    Thread Starter bencurious

    (@bencurious)

    https://www.koha.biz/wordpress/ check out an article too see ?? Site still work in progress

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Ad a check box for terms and conditions for comments’ is closed to new replies.