<commit_before><?php

/*
 * This file is part of the symfony package.
 * (c) 2004, 2005 <NAME> <<EMAIL>>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 * ValidationHelper.
 *
 * @package    symfony
 * @subpackage helper
 * @author     <NAME> <<EMAIL>>
 * @version    SVN: $Id$
 */

function form_has_error($param)
{
  return sfContext::getInstance()->getRequest()->hasError($param);
}

function form_error($param, $options = array())
{
  $options = _parse_attributes($options);

  $request = sfContext::getInstance()->getRequest();

  $options['controltovalidate'] = $param;
  $options['display'] = 'Dynamic';
  if ($request->hasError($param))
  {
    $options['isvalid'] = 'False';
    $style = '';
  }
  else
  {
    $style = 'display:none;';
  }
  $options['style'] = isset($options['style']) ? $options['style'].';'.$style : $style;
  if (!isset($options['class'])) $options['class'] = 'form_error';
  if (!isset($options['id'])) $options['id'] = 'content:_TRequiredFielValidator';

  $prefix = '&darr;&nbsp;';
  if (isset($options['prefix']))
  {
    $prefix = $options['prefix'];
    unset($options['prefix']);
  }

  $suffix = '&nbsp;&darr;';
  if (isset($options['suffix']))
  {
    $prefix = $options['suffix'];
    unset($options['suffix']);
  }

  $error = $request->getError($param);

  return content_tag('div', $prefix.$error.$suffix, $options)."\n";
}

function add_dynamic_validation()
{
  return <<<EOF
<script type="text/javascript">
<!--
/*<![CDATA[*/
var Page_Validators=new Array(document.getElementById("content:_TRequiredFieldValidator1"), document.getElementById("content:_TCustomValidator2"), document.getElementById("content:_TRequiredFieldValidator3"));
var Validator_Events=new Array("content:_TButton4");
/*]]>*/
// -->
</script>

<script type="text/javascript">
<!--
/*<![CDATA[*/

var Page_ValidationActive = false;
if (typeof(Page_ValidationVer) == "undefined")
  alert("Unable to find script library '/examples/js/prado_validator.js'. Try placing this file manually, or redefine constant JS_VALIDATOR in TValidator.php.");<commit_msg>fixed a typo in ValidationHelper<commit_after><?php

/*
 * This file is part of the symfony package.
 * (c) 2004, 2005 <NAME> <<EMAIL>>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 * ValidationHelper.
 *
 * @package    symfony
 * @subpackage helper
 * @author     <NAME> <<EMAIL>>
 * @version    SVN: $Id$
 */

function form_has_error($param)
{
  return sfContext::getInstance()->getRequest()->hasError($param);
}

function form_error($param, $options = array())
{
  $options = _parse_attributes($options);

  $request = sfContext::getInstance()->getRequest();

  $options['controltovalidate'] = $param;
  $options['display'] = 'Dynamic';
  if ($request->hasError($param))
  {
    $options['isvalid'] = 'False';
    $style = '';
  }
  else
  {
    $style = 'display:none;';
  }
  $options['style'] = isset($options['style']) ? $options['style'].';'.$style : $style;
  if (!isset($options['class'])) $options['class'] = 'form_error';
  if (!isset($options['id'])) $options['id'] = 'content:_TRequiredFielValidator';

  $prefix = '&darr;&nbsp;';
  if (isset($options['prefix']))
  {
    $prefix = $options['prefix'];
    unset($options['prefix']);
  }

  $suffix = '&nbsp;&darr;';
  if (isset($options['suffix']))
  {
    $suffix = $options['suffix'];
    unset($options['suffix']);
  }

  $error = $request->getError($param);

  return content_tag('div', $prefix.$error.$suffix, $options)."\n";
}

function add_dynamic_validation()
{
  return <<<EOF
<script type="text/javascript">
<!--
/*<![CDATA[*/
var Page_Validators=new Array(document.getElementById("content:_TRequiredFieldValidator1"), document.getElementById("content:_TCustomValidator2"), document.getElementById("content:_TRequiredFieldValidator3"));
var Validator_Events=new Array("content:_TButton4");
/*]]>*/
// -->
</script>

<script type="text/javascript">
<!--
/*<![CDATA[*/

var Page_ValidationActive = false;
if (typeof(Page_ValidationVer) == "undefined")
  alert("Unable to find script library '/examples/js/prado_validator.js'. Try placing this file manually, or redefine constant JS_VALIDATOR in TValidator.php.");
{'fraction_non_alphanumeric': 0.19580741764570375, 'fraction_numerical': 0.0055286800276434, 'mean_word_length': 5.03894297635605, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5512066', 'n_tokens_mistral': 1383, 'n_tokens_neox': 1346, 'n_words': 287}