src/UI/HTML/FormElements.php
public static function Select( $name, $options, $class = NULL, $readOnly = NULL, $submit = NULL, $focus = NULL, $change = NULL )
	{
		if( is_array( $options ) )
		{
			$selected	= isset( $options['_selected'] ) ? $options['_selected'] : NULL;
			$options	= self::Options( $options, $selected );
		}
		$focus	= $focus	? "document.getElementById('".$focus."').focus();" : NULL;
		$submit	= $submit	? "document.getElementById('form_".$submit."').submit();" : NULL;
		$attributes	= array(
			'id'		=> str_replace( "[]", "", $name ),
			'name'		=> $name,
			'class'		=> $class,
			'multiple'	=> substr( trim( $name ), -2 ) == "[]"	? "multiple" : NULL,
			'onchange'	=> $focus.$submit.$change ? $focus.$submit.$change : NULL,
		);
		if( $readOnly ){
			$attributes['readonly']		= "readonly";
			if( is_string( $readOnly ) && strlen( trim( $readOnly ) ) )
				$attributes['onmousedown']		= "alert('".htmlentities( $readOnly, ENT_QUOTES, 'UTF-8' )."'); return false;";
			else
				self::addDisabledAttributes( $attributes, TRUE );
		}
		return UI_HTML_Tag::create( "select", $options, $attributes );
	}
public static function Select( $name, $options, $class = NULL, $readOnly = NULL, $submit = NULL, $focus = NULL, $change = NULL )
	{
		if( is_array( $options ) )
		{
			$selected	= isset( $options['_selected'] ) ? $options['_selected'] : NULL;
			$options	= self::Options( $options, $selected );
		}
		$focus	= $focus	? "document.getElementById('".$focus."').focus();" : NULL;
		$submit	= $submit	? "document.getElementById('form_".$submit."').submit();" : NULL;
		$attributes	= array(
			'id'		=> str_replace( "[]", "", $name ),
			'name'		=> $name,
			'class'		=> $class,
			'multiple'	=> substr( trim( $name ), -2 ) == "[]"	? "multiple" : NULL,
			'onchange'	=> $focus.$submit.$change ? $focus.$submit.$change : NULL,
		);
		if( $readOnly ){
			$attributes['readonly']		= "readonly";
			if( is_string( $readOnly ) && strlen( trim( $readOnly ) ) )
				$attributes['onmousedown']		= "alert('".htmlentities( $readOnly, ENT_QUOTES, 'UTF-8' )."'); return false;";
			else
				self::addDisabledAttributes( $attributes, TRUE );
		}
		return UI_HTML_Tag::create( "select", $options, $attributes );
	}
public static function Select ( $ name , $ options , $ class = NULL , $ readOnly = NULL , $ submit = NULL , $ focus = NULL , $ change = NULL ) { if ( is_array ( $ options ) ) { $ selected = isset ( $ options [ '_selected' ] ) ? $ options [ '_selected' ] : NULL ; $ options = self :: Options ( $ options , $ selected ) ; } $ focus = $ focus ? "document.getElementById('" . $ focus . "').focus();" : NULL ; $ submit = $ submit ? "document.getElementById('form_" . $ submit . "').submit();" : NULL ; $ attributes = array ( 'id' => str_replace ( "[]" , "" , $ name ) , 'name' => $ name , 'class' => $ class , 'multiple' => substr ( trim ( $ name ) , - 2 ) == "[]" ? "multiple" : NULL , 'onchange' => $ focus . $ submit . $ change ? $ focus . $ submit . $ change : NULL , ) ; if ( $ readOnly ) { $ attributes [ 'readonly' ] = "readonly" ; if ( is_string ( $ readOnly ) && strlen ( trim ( $ readOnly ) ) ) $ attributes [ 'onmousedown' ] = "alert('" . htmlentities ( $ readOnly , ENT_QUOTES , 'UTF-8' ) . "'); return false;" ; else self :: addDisabledAttributes ( $ attributes , TRUE ) ; } return UI_HTML_Tag :: create ( "select" , $ options , $ attributes ) ; }
Builds HTML Code for a Select.
@access		public
@static
@param		string		$name			Field Name
@param		mixed		$options		Array of String of Options
@param		string		$class			CSS Class (xl|l|m|s|xs)
@param		mixed		$readOnly		Field is not writable, JavaScript Alert if String is given
@param		string		$submit			ID of Form to submit on Change
@param		string		$focus			ID of Element to focus on Change
@param		string		$change			JavaScript to execute on Change
@return		string
Builds HTML Code for a Select .