20 $p = parent::validate( $value, $alldata );
28 if ( in_array( strval( $value ), $validOptions,
true ) ) {
31 return $this->
msg(
'htmlform-select-badoption' );
40 $select =
new XmlSelect( $this->mName, $this->mID, strval( $value ) );
42 if ( !empty( $this->mParams[
'disabled'] ) ) {
43 $select->setAttribute(
'disabled',
'disabled' );
46 $allowedParams = [
'tabindex',
'size' ];
48 foreach ( $customParams as $name => $value ) {
49 $select->setAttribute( $name, $value );
52 if ( $this->mClass !==
'' ) {
53 $select->setAttribute(
'class', $this->mClass );
58 return $select->getHTML();
67 $allowedParams = [
'tabindex' ];
68 $attribs = \OOUI\Element::configFromHtmlAttributes(
72 if ( $this->mClass !==
'' ) {
76 if ( !empty( $this->mParams[
'disabled'] ) ) {
80 return new \OOUI\DropdownInputWidget( [
81 'name' => $this->mName,
84 'value' => strval( $value ),
85 'disabled' => $disabled,
90 $select =
new XmlSelect( $this->mName, $this->mID, strval( $value ) );
92 if ( !empty( $this->mParams[
'disabled'] ) ) {
93 $select->setAttribute(
'disabled',
'disabled' );
96 $allowedParams = [
'tabindex',
'size' ];
98 foreach ( $customParams as $name => $value ) {
99 $select->setAttribute( $name, $value );
103 $selectClass =
'cdx-select';
104 $selectClass .= $this->mClass !==
'' ?
' ' . $this->mClass :
'';
105 $select->setAttribute(
'class', $selectClass );
109 return $select->getHTML();
122class_alias( HTMLSelectField::class,
'HTMLSelectField' );