<?php
/**
 * @version		$Id: equals.php 379 2009-06-17 07:16:53Z eddieajau $
 * @package		JXtended.Libraries
 * @subpackage	Form
 * @copyright	Copyright (C) 2008 - 2009 JXtended, LLC. All rights reserved.
 * @license		GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
 * @link		http://jxtended.com
 */

defined('JPATH_BASE') or die;

/**
 * @package		JXtended.Libraries
 * @subpackage	Forms
 * @static
 */
class JXFormValidateEquals
{
	function test(&$field, &$values)
	{
		$result = true;

		if ($field1 = $field->attributes('field'))
		{
			$field12 = $field->attributes('name');
			if ($values->get($field1) != $values->get($field12)) {
				$result = false;
			}
		}
		else {
			$result = new JException('Field attribute not found to support equals validator');
		}

		return $result;
	}
}