Welcome, Guest
  • Page:
  • 1

TOPIC: Text area scroll validation

Text area scroll validation 2 years, 3 months ago #11809

I have been trying to figure this out on my own, but I have had no luck. I know this is going to be simple for somebody..

Here is what I am trying to do:

There are instances where you want to force a user to view an entire piece of text. The particular instance that comes to mind is in the case of License Agreements. You want to be sure that the user has, at least, scrolled through the entire agreement before allowing them to proceed.

function textareaAtEnd(textareaObj)
{
	return ((textareaObj.scrollTop + textareaObj.offsetHeight) > textareaObj.scrollHeight);
}

To use it, you would do:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<title>Scroll Test</title>
	<script language="JavaScript">
	<!--
	
	function textareaAtEnd(textareaObj)
	{
		return ((textareaObj.scrollTop + textareaObj.offsetHeight) > textareaObj.scrollHeight);
	}

	function formValidation(formObj)
	{
		if (textareaAtEnd(formObj.licenseAgreement))
		{
			return true;
		}
		else
		{
			alert ("Please scroll to the end of the license agreement.")
			return false;
		}
	}

	// -->
	</script>


I have tried everything I know, which isn't much. I am hoping once this is shown to me I will understand were I was going wrong.

Thanks,

Doug
  • dmarzean
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Karma: 0

Re: Text area scroll validation 2 years, 3 months ago #12165

I could use this too!! (but for Privacy Policy - same functionality needed though)
  • cebby
  • OFFLINE
  • Senior Boarder
  • Posts: 63
  • Karma: 1
Last Edit: 2 years, 3 months ago by cebby.
  • Page:
  • 1
Moderators: TheMuffinMan, ForumSupport
Time to create page: 0.38 seconds

Facebook Discount - 40% Off!

Fans of our Facebook page here are entitled to get a 1-year-subscription for the price of a 6-months!

Steps to take:

  • Become a fan on Facebook (Like) here
  • Purchase a 6-months-subscription from here
  • Write a quick email to This email address is being protected from spambots. You need JavaScript enabled to view it. with your username and prove of your like and we'll upgrade to the 1-year-subscription

Joomla!® Forms Discount - 40% Off!

Already purchased a forms extension from a different vendor but your requirements changed and now you need a forms extension that is capable of more than just the standards? We help you to keep the costs for a change under control: Get a 40% discount on our professional membership plan! -- meaning timely unlimited access to all current and future commercial extensions, breezingforms themes & apps and Joomla!® templates at crosstec.de, including 1 year of support -- without any website limitations -- Just prove that you previously purchased another forms extension for Joomla!® from a different vendor and you are qualified.

Steps to take:

  • Purchase a 1-year-subscription from here
  • Write a quick email to This email address is being protected from spambots. You need JavaScript enabled to view it. with your username and prove of the purchase for the other form vendor and we'll upgrade to the professional-subscription

About

Crosstec GmbH & Co. KG

Bergisch-Gladbacher-Str. 829

51069 Cologne, Germany

Imprint