It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

prefilled passwords in FireFox

prefilled passwords in FireFox

Postby ssprog on Mon Jul 14, 2008 6:05 pm

Hello.

I am using a label on top of a textbox to create a watermark effect. The label says "user name" or "password", but when the textbox gets the focus, the label disappears...

In Firefox, when it remembers a password from a previous session, it pre-fills in the form for you. This is disrupting the watermark effect, bec. it doesn't seem to fire a change event or focus event. I am ending up with a watermark and a pre-filled text box.

Any ideas what event fires when FF fills in the data? Any ideas how to get around this?

Thanks,
Solomon
ssprog
 
Posts: 2
Joined: Mon Jul 14, 2008 5:32 pm

Postby rangana on Tue Jul 15, 2008 1:21 am

I could see two possibilities for this.

1. Add autocomplete="off" on the form that contains your textbox.

2. Add a script to ensure that the textbox don't have a value on load. Something along this lines:
Code: Select all
<script type="text/javascript">
window.onload=function()
{document.getElementById('mytextbox').value='';}
</script>

Just ensure to replace mytextbox with the id of your textbox.

Hope it helps.
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines

Postby ssprog on Tue Jul 15, 2008 12:59 pm

Thank You. I'll give it a shot.
ssprog
 
Posts: 2
Joined: Mon Jul 14, 2008 5:32 pm

Postby rangana on Tue Jul 15, 2008 11:47 pm

No problem. Glad I could help ;)

Get back if whenever you're still stumped.
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines


Who is online

Users browsing this forum: No registered users and 2 guests