Jump to content

changing form values


elmas156

Recommended Posts

I have a form for  a sign in page that I want the label for the form field to actually be displayed in the text box and clear when the box is selected to enter text.  I've accomplished this using the code below and it works fine.  The problem that I'm having is in IE the password field does not change to display dots or asterisk in place of each character.  It works fine in Fire Fox but not in IE.  Is there way to accomplish this using php or so that it is compatible with most browsers?

 

Here's the code that I'm using:

<?php

echo "<input type=\"text\" name=\"pword\" size=\"17\" value=\"Password...\" style=\"color: #999999\" onfocus=\"if (this.value == 'Password...') {this.value=''; this.style.color='#000000'; this.type='password';}\"> ";

?>

Link to comment
https://forums.phpfreaks.com/topic/213530-changing-form-values/
Share on other sites

Why don't you just set the HTML attribute type to password instead of text? Even though it will say "********" by default, I'm pretty sure people will realize it's a password, even more so if it's below a text box that says "Username".

 

As to your question for a PHP solution to your problem. No there isn't. It needs to be client-side, so JavaScript.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.