Message fixes for Ia1878588.
[lhc/web/wiklou.git] / includes / HTMLForm.php
index ce9c377..db29436 100644 (file)
@@ -1109,7 +1109,7 @@ abstract class HTMLFormField {
         * @return Mixed Bool true on success, or String error to display.
         */
        function validate( $value, $alldata ) {
-               if ( isset( $this->mParams['required'] ) && $value === '' ) {
+               if ( isset( $this->mParams['required'] ) && $this->mParams['required'] !== false && $value === '' ) {
                        return wfMsgExt( 'htmlform-required', 'parseinline' );
                }
 
@@ -1527,18 +1527,15 @@ class HTMLTextField extends HTMLFormField {
                        $attribs['class'] = $this->mClass;
                }
 
-               if ( isset( $this->mParams['maxlength'] ) ) {
-                       $attribs['maxlength'] = $this->mParams['maxlength'];
-               }
-
                if ( !empty( $this->mParams['disabled'] ) ) {
                        $attribs['disabled'] = 'disabled';
                }
 
                # TODO: Enforce pattern, step, required, readonly on the server side as
                # well
-               foreach ( array( 'min', 'max', 'pattern', 'title', 'step',
-               'placeholder' ) as $param ) {
+               $allowedParams = array( 'min', 'max', 'pattern', 'title', 'step',
+                       'placeholder', 'list', 'maxlength' );
+               foreach ( $allowedParams as $param ) {
                        if ( isset( $this->mParams[$param] ) ) {
                                $attribs[$param] = $this->mParams[$param];
                        }
@@ -2153,7 +2150,7 @@ class HTMLSelectAndOtherField extends HTMLSelectField {
                        return $p;
                }
 
-               if ( isset( $this->mParams['required'] ) && $value[1] === '' ) {
+               if ( isset( $this->mParams['required'] ) && $this->mParams['required'] !== false && $value[1] === '' ) {
                        return wfMsgExt( 'htmlform-required', 'parseinline' );
                }