This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Terms of Agreement


  1. sjones
    Member

    Hello. I need to put a terms of agreement statement on the bottom of my form.
    If the user selects the "I agree" radio button, they will then be able to submit form. If they select the "I do not agree" radio button, they will not be able to submit the form. Is there any way of doing this?

    Posted 14 years ago #
  2. yuniar

    Hmm.. there is no exact way to do that.
    However, I have some suggestion.

    You can simply create ONE checkbox with the label "I agree" and then set the field as required.

    If the user don't agree, he won't fill the checkbox and when the form submitted it would fail, since the checkbox is required.

    Otherwise if he fill the checkbox, the form should be submitted properly.


    MachForm Founder

    Posted 14 years ago #
  3. sjones
    Member

    Thanks for the response back Yuniar.

    I figured that would have to be the way.

    If I may make a suggestion that this type of thing be implemented in some future version. For legal purposes, it is really the only way a person can "sign" and online form.

    Posted 14 years ago #
  4. redityo

    Hi,

    You can add small validation for agreement logic, for example I assume you've form id = 8 with an agreement radio field id = 1 in there.

    Radio field will have 2 option, that is :

    1. I agree
    2. Not agree ( here is the condition where the error will occurs)

    Then you need to edit "includes/post-functions.php" file. Go around line 212 ~214 and you'll see these code :

    if($validation_result !== true){
    	$error_elements[$element_id] = $validation_result;
    }

    put these code exactly bellow that line

    if ($form_id == 8 && $element_id == 1) {
    	if (!empty($element_data))
    	{
    		if ($element_data == "2")
    			$error_elements[$element_id] = "You not agree with the agreement";
    	}
    }

    Don't forget to change the Id's with yours


    MachForm Support

    Posted 14 years ago #
  5. sjones
    Member

    Redityo: Thanks for the suggestion. It worked perfectly.

    Posted 14 years ago #

RSS feed for this topic

Reply