ThemeShaper Forums » Thematic

[closed]

Default text input value

(2 posts)
  • Started 8 years ago by joshuaiz
  • Latest reply from Jonny Janiero
  • This topic is not resolved
  1. joshuaiz
    Member

    Hi,

    I want to add default text to the input box for a login form but I don't know where to put it. In the code below, there is already something in the value field so I guess I just need to know how to add the default text of 'Username' to show up in the input box along with the <?php echo esc_attr(stripslashes($user_login)); ?> function.

    <div class="username">
    					<label for="user_login"><?php _e('Username'); ?>: </label>
    					<input type="text" name="log" value="<?php echo esc_attr(stripslashes($user_login)); ?>" size="20" id="user_login" tabindex="11" />
    				</div>

    I'm sure this is pretty straightforward but any help would be appreciated.

    Posted 8 years ago #
  2. hmmm try

    <div class="username">
    <?php $username = esc_attr(stripslashes($user_login)); ?>
    <label for="user_login"><?php _e('Username'); ?>: </label>
    <input type="text" name="log" value="<?php echo $username; ?>" onfocus="if (this.value == '<?php echo $username; ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php echo $username; ?>';}" size="20" id="user_login" tabindex="11" />
    </div>

    just so you know, i haven't tested this (thinking out loud)

    hope this helps

    Posted 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.