Hi there,

The design I have to convert to Drupal requires the username and password fields to contain the words 'username' and 'password' rather than than being preceded by some title text like they are by default. I have managed to do this for the username by overriding 'user_login_block' but when I do the same for the password field I get dots not text. I appreciate this is due to the type of field but regardless of this it is my job to sort it out and get it looking like the PSD file I've been given! :-( Solutions warmly welcomed, even nasty kludges if that's what it takes!

Thanks guys (code follows),

Roger.

    function cmls_user_login_block($form)
        {
            $output = '';   //$output .= print_r($form);

            // Username box
            $form['name']['#title'] = '';
            $form['name']['#value'] = 'username';
            $form['name']['#attributes'] = array('class' => t('NormalTextBox'),
                'onfocus' => "if (this.value == 'username') {this.value = '';}",
                'onblur' => "if (this.value == '') {this.value = 'username';}");

            // Password box
            $form['pass']['#title'] = '';
            $form['pass']['#value'] = 'password';
            $form['pass']['#attributes'] = array('class' => t('NormalTextBox'),
                'onfocus' => "if (this.value == 'password') {this.value = '';}",
                'onblur' => "if (this.value == '') {this.value = 'password';}");

            // Links
            unset( $form['links']['#value'] );
            $form['links']['#value'] = '<div class="item-list">'.
                                           '<ul>'.
                                               '<li class="first">'.
                                                   '<a href="/user/register" title="Register a new account">Register</a>'.
                                               '</li>'.
                                               '<li class="last">'.
                                                   '<a href="/user/password" title="Request new password via e-mail.">Lost Password</a>'.
                                               '</li>'.
                                           '</ul>'.
                                       '</div>';

            $output .= drupal_render($form);
            return $output;
        }

Comments

r0g’s picture

Maybe with Javascript!? Has nobody here needed to do this before? :(