* @return HTMLForm $this for chaining calls (since 1.20)
*/
public function setMethod( $method = 'post' ) {
- $this->mMethod = $method;
+ $this->mMethod = strtolower( $method );
return $this;
}
+ /**
+ * @return string Always lowercase
+ */
public function getMethod() {
return $this->mMethod;
}
* Automatically does validation that the title is valid,
* as well as autocompletion if using the OOUI display format.
*
- * FIXME: Does not work for forms that support GET requests.
+ * Note: Forms using GET requests will need to make sure the title value is not
+ * an empty string.
*
* Optional parameters:
* 'namespace' - Namespace the page must be in
}
public function validate( $value, $alldata ) {
+ if ( $this->mParent->getMethod() === 'get' && $value === '' ) {
+ // If the form is a GET form and has no value, assume it hasn't been
+ // submitted yet, and skip validation
+ return parent::validate( $value, $alldata );
+ }
try {
$title = Title::newFromTextThrow( $value );
} catch ( MalformedTitleException $e ) {