From: Brad Jorsch Date: Fri, 28 Feb 2014 21:42:27 +0000 (-0500) Subject: HTMLForm: Support 'url' type X-Git-Tag: 1.31.0-rc.0~16640^2 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=4bd9a382b8d629dbeab70e220bcf70dfc4ba5f1e;p=lhc%2Fweb%2Fwiklou.git HTMLForm: Support 'url' type SecurePoll will have a field that's a url, so we may as well use the correct HTML5 input type for it. Change-Id: Id3ddd8f2efdff08c8a188089d321d143ce5ef9c9 --- diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php index 3e2a09e2fc..f4b16cc5f4 100644 --- a/includes/htmlform/HTMLForm.php +++ b/includes/htmlform/HTMLForm.php @@ -118,10 +118,11 @@ class HTMLForm extends ContextSource { 'edittools' => 'HTMLEditTools', 'checkmatrix' => 'HTMLCheckMatrix', // HTMLTextField will output the correct type="" attribute automagically. - // There are about four zillion other HTML5 input types, like url, but + // There are about four zillion other HTML5 input types, like range, but // we don't use those at the moment, so no point in adding all of them. 'email' => 'HTMLTextField', 'password' => 'HTMLTextField', + 'url' => 'HTMLTextField', ); public $mFieldData; diff --git a/includes/htmlform/HTMLTextField.php b/includes/htmlform/HTMLTextField.php index 57f0a72527..e584d886c4 100644 --- a/includes/htmlform/HTMLTextField.php +++ b/includes/htmlform/HTMLTextField.php @@ -43,9 +43,6 @@ class HTMLTextField extends HTMLFormField { # is essentially just a clone of this one. if ( isset( $this->mParams['type'] ) ) { switch ( $this->mParams['type'] ) { - case 'email': - $attribs['type'] = 'email'; - break; case 'int': $attribs['type'] = 'number'; break; @@ -54,8 +51,10 @@ class HTMLTextField extends HTMLFormField { $attribs['step'] = 'any'; break; # Pass through + case 'email': case 'password': case 'file': + case 'url': $attribs['type'] = $this->mParams['type']; break; }