From: Aryeh Gregor Date: Mon, 7 Sep 2009 01:48:06 +0000 (+0000) Subject: Don't output for= that doesn't point anywhere X-Git-Tag: 1.31.0-rc.0~39885 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=650e0d72ac31e002003a7a1bf36f9571cdd78bd2;p=lhc%2Fweb%2Fwiklou.git Don't output for= that doesn't point anywhere This fixes an HTML validity issue with HTMLForm. --- diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 335efeaed4..d66f859907 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -384,6 +384,16 @@ abstract class HTMLFormField { return $value; } + /** + * Should this field have a label, or is there no input element with the + * appropriate id for the label to point to? + * + * @return bool True to output a label, false to suppress + */ + protected function needsLabel() { + return true; + } + function loadDataFromRequest( $request ) { if( $request->getCheck( $this->mName ) ) { return $request->getText( $this->mName ); @@ -455,8 +465,14 @@ abstract class HTMLFormField { $html = ''; + # Don't output a for= attribute for labels with no associated input. + # Kind of hacky here, possibly we don't want these to be