Fix default value of domain select box in templates
authorBartosz Dziewoński <matma.rex@gmail.com>
Wed, 16 Oct 2013 17:11:26 +0000 (19:11 +0200)
committerParent5446 <tylerromeo@gmail.com>
Mon, 21 Oct 2013 01:20:40 +0000 (01:20 +0000)
There is no such thing as <select value="">. Use XmlSelect class to
properly build the selector instead.

Change-Id: If23071f29bf1ca8d7364453ec6c464127fecb509

includes/templates/Usercreate.php
includes/templates/Userlogin.php

index 4750af9..2f569d9 100644 (file)
@@ -113,17 +113,16 @@ class UsercreateTemplate extends BaseTemplate {
 
                        <?php
                        if ( $this->data['usedomain'] ) {
-                               $doms = "";
+                               $select = new XmlSelect( 'wpDomain', false, $this->data['domain'] );
+                               $select->setAttribute( 'tabindex', 4 );
                                foreach ( $this->data['domainnames'] as $dom ) {
-                                       $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
+                                       $select->addOption( $dom );
                                }
                        ?>
                                <div id="mw-user-domain-section">
                                        <label for="wpDomain"><?php $this->msg( 'yourdomainname' ); ?></label>
                                        <div class="mw-input">
-                                               <select name="wpDomain" value="<?php $this->text( 'domain' ); ?>" tabindex="4">
-                                                       <?php echo $doms ?>
-                                               </select>
+                                               <?php echo $select->getHTML(); ?>
                                        </div>
                                </div>
                        <?php } ?>
index 5eb6094..38e071c 100644 (file)
@@ -113,16 +113,15 @@ class UserloginTemplate extends BaseTemplate {
 
                        <?php
                        if ( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
-                               $doms = "";
+                               $select = new XmlSelect( 'wpDomain', false, $this->data['domain'] );
+                               $select->setAttribute( 'tabindex', 3 );
                                foreach ( $this->data['domainnames'] as $dom ) {
-                                       $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
+                                       $select->addOption( $dom );
                                }
                        ?>
                                <div id="mw-user-domain-section">
                                        <label for='wpDomain'><?php $this->msg( 'yourdomainname' ); ?></label>
-                                       <select name="wpDomain" value="<?php $this->text( 'domain' ); ?>" tabindex="3">
-                                               <?php echo $doms; ?>
-                                       </select>
+                                       <?php echo $select->getHTML(); ?>
                                </div>
                        <?php } ?>