4 * A select dropdown field. Basically a wrapper for Xmlselect class
6 class HTMLSelectField
extends HTMLFormField
{
7 function validate( $value, $alldata ) {
8 $p = parent
::validate( $value, $alldata );
14 $validOptions = HTMLFormField
::flattenOptions( $this->getOptions() );
16 if ( in_array( strval( $value ), $validOptions, true ) ) {
19 return $this->msg( 'htmlform-select-badoption' )->parse();
23 function getInputHTML( $value ) {
24 $select = new XmlSelect( $this->mName
, $this->mID
, strval( $value ) );
26 if ( !empty( $this->mParams
['disabled'] ) ) {
27 $select->setAttribute( 'disabled', 'disabled' );
30 $allowedParams = array( 'tabindex', 'size' );
31 $customParams = $this->getAttributes( $allowedParams );
32 foreach ( $customParams as $name => $value ) {
33 $select->setAttribute( $name, $value );
36 if ( $this->mClass
!== '' ) {
37 $select->setAttribute( 'class', $this->mClass
);
40 $select->addOptions( $this->getOptions() );
42 return $select->getHTML();