Add Terms and Conditions functionality

How can i add Terms and conditions functionality to my form ?

Very often you will need to ask the user to agree with your terms and conditions before he can submit the form. You can do this quite nicely with RSform!Pro. We will allow the form to be submitted only after you have scrolled down the textarea.

Steps:

Add necessary fields: You will need to add a textarea that will allow you to display the terms. You will need to also add a checkbox element, for the "agree" part.

  • Textarea. In the Default value area, we will add the terms and conditions text. This can be as long as you like. Since the user should not be allowed to edit this, we should make the field readonly. To enable this, head to the Attributes tab, and add readonly="readonly" into Additional Attributes area.
  • Checkbox. In the Items section we will only need one element. You can type in "I agree" for example. We will need to trigger a small Javascript function that will verify if the textarea has been scrolled to the bottom. We can easily do this in the Attributes tab, in Additional Attributes section, add this: onclick="return textareaAtEnd(document.getElementById('textarea'));"

 

Add Javascript function: The small function is required to check whether the terms and conditions textarea has been scrolled to the bottom or not. You will need to head to the Properties > CSS/Javascript: Javascript area, and add the following script:

 
<script type="text/javascript">
function textareaAtEnd(area)
{
  bul = false;
  bul = (area.scrollTop + area.offsetHeight) > area.scrollHeight ;
  if(!bul)
  {
    alert('Scroll the terms and conditions textbox');
    document.getElementById('name_of_agree_checkbox0').checked = false;
  }
    return bul;
}
</script>
 
Note:

Instead of name_of_agree_checkbox, you will have to use the name of your agree checkbox group.


6 persons found this article helpful.


Was this article helpful?

Yes No
Sorry about that

You Should Also Read

Unique email address validation rule HOT

Display a message on the top side of the form if validation fails

Ajax validation is not working

RSForm! Pro regular expression (regex) validation does not work!

How do i validate special chars?