Closed (fixed)
Project:
Compact Forms
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 May 2009 at 12:23 UTC
Updated:
20 May 2009 at 23:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
pounardThere are some problems with current JS, like, when using firefox, password autocompletion does not seems to fire the focus event, and the content does not erase, so we have both "***" and text printed over each other.
Comment #2
gregglesComment #3
pounardNote: this is absolutely not a patch, but a example snippet
Comment #4
gregglesWell, it's something more than "active" ;)
Comment #5
sunMarking as duplicate of #165608: Move the label text to the form field value. Please search for existing issues before creating a new one. You can follow up on that issue instead to track its status. If any information from this issue is missing in the other issue, please make sure you provide it over there.
However, thanks for taking the time to report this issue.
Comment #6
pounardIt's not an issue report, it's a real rewrite proposal (I would not write it as feature request else)!
Comment #7
sunWell, what I miss in this issue is a clear description why you want to rewrite it, and why we shouldn't work on solving bugs instead. The current JavaScript we have works fine from what I can tell, so we need a very good reason for rewriting it.
Comment #8
pounardThe snippet I gave to you is the one I use since a lot of time. This one handle the firefox problem with autocomplete password, I think it should be a great sample for you to fix it.
And, despite the fact you handle more feature, I think this code base is a bit cleaner, and might be a good base for rewriting your JS if you are unable to fix bugs with the current version, adding your features shouldn't be too difficult with this codebase.
It's up to you. But I think (I might be wrong) it's a good track to improve your current JS.
Comment #9
pounardBy the way, I did some code cleaning or your JS, added some ";" at end of var = function() {}; (this is mandatory, browsers won't yell, but some js compactors will fail because of this).
I also removed some $() which was not needed.
Comment #10
pounardThe firefox with remembered password is really annoying, I tried those events:
change, unload, focus, keypress, load, click, and more...
no event all seems to be fired in javascript by firefox when it autocomplete a remembered password.
Comment #11
sunNice catches!
To prevent this in the future, jQuery objects should always be prefixed with $ in the variable name, so
would needs to become
That way, it's clear that both $label and $field are jQuery objects already - no need to jQuerify them again.
Comment #12
pounardYep, that's a weird naming convention, but it's explicit!
I lookup a lot for the Firefox bug, I think there is no solution. Firefox writes remembered passwords without really writing the value into the dom, and awaits for the user to interact or submit to really put the data. I think this a security measure to avoid malicious cross-scripted scripts to catch up people passwords.
There is no clean solution about this I think, may be other snippets have a solution, I did not find it.
Talking with some colleagues, they catched the point that it's dangerous to try to alter some password field because of numerous security measures the browser could apply to it; no one did find out a solution with this, neither a single track where to find it.
Comment #13
sunCommitted attached patch. Thanks.