<commit_before><?php
/**
 * @license https://raw.github.com/mediaslave/phrails/master/LICENSE The MIT License
 * @package html
 */
/**
 * class description
 *
 * @package html
 */
abstract class FormElement extends Element
{
	public $value = '';
	protected $is_hidden = false;
	private $optionExceptions = array('tab'=>'tabindex');
	/**
	 * Constructor
	 *
	 * @param string $display
	 * @param string or array $options
	 * @author <NAME>
	 */
	function __construct($name, $value, $options=null, array $optionExceptions=array())
	{
		if($name != ''){
			if($this->options !== ''){
				$this->options .= ',';
			}
			$this->options .= "name:$name";
		}
		if($value !== null){
			$this->value = $value;
		}else{
			$this->value = OptionsParser::findAndDestroy('value', $options);
		}
		if(!$this->is_hidden){
			$id = self::getId($name);
			$this->options .= ",id:$id";
		}
		parent::__construct($options, array_merge($this->optionExceptions, $optionExceptions));
	}

	/**
	 * Generate the id statically
	 *
	 * @return string
	 * @author <NAME>
	 **/
	public static function getId($name)
	{
		//$id = $name . '_id';
		$id = str_replace('[', '_', $name);
		return str_replace(']', '_', $id) . '_id';
		$matches = array();
		if(preg_match("/^(?P<table>[a-z_]*)\[(?P<id>[a-zA-Z_]*)\](\[(?P<array>[a-z0-9A-Z_\-\.]?)\])*/i", $id, $matches)<commit_msg>Adjust id to not have underscore when processing the id from a name of an element<commit_after><?php
/**
 * @license https://raw.github.com/mediaslave/phrails/master/LICENSE The MIT License
 * @package html
 */
/**
 * class description
 *
 * @package html
 */
abstract class FormElement extends Element
{
	public $value = '';
	protected $is_hidden = false;
	private $optionExceptions = array('tab'=>'tabindex');
	/**
	 * Constructor
	 *
	 * @param string $display
	 * @param string or array $options
	 * @author <NAME>
	 */
	function __construct($name, $value, $options=null, array $optionExceptions=array())
	{
		if($name != ''){
			if($this->options !== ''){
				$this->options .= ',';
			}
			$this->options .= "name:$name";
		}
		if($value !== null){
			$this->value = $value;
		}else{
			$this->value = OptionsParser::findAndDestroy('value', $options);
		}
		if(!$this->is_hidden){
			$id = self::getId($name);
			$this->options .= ",id:$id";
		}
		parent::__construct($options, array_merge($this->optionExceptions, $optionExceptions));
	}

	/**
	 * Generate the id statically
	 *
	 * @return string
	 * @author <NAME>
	 **/
	public static function getId($name)
	{
		//$id = $name . '_id';
		$id = str_replace('[', '_', $name);
		return str_replace(']', '_', $id) . 'id';
		$matches = array();
		if(preg_match("/^(?P<table>[a-z_]*)\[(?P<id>[a-zA-Z_]*)\](\[(?P<array>[a-z0-9A-Z_\-\.]?)\])*/i", $id, $matches)
{'fraction_non_alphanumeric': 0.22488211824446863, 'fraction_numerical': 0.0014508523757707653, 'mean_word_length': 3.7881944444444446, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 31, 'https://': 2, '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': '1315746', 'n_tokens_mistral': 1069, 'n_tokens_neox': 971, 'n_words': 194}