I have a website where we use Javascript to submit the login form. On Firefox it prompts the user to remember their password, when they login, but on IE7 it doesn’t.
After doing some research it looks like the user is only prompted in IE7 when the form is submitted via a Submit control. I’ve created some sample html to prove this is the case.
<html> <head> <title>test autocomplete</title> <script type='text/javascript'> function submitForm() { return document.forms[0].submit(); } </script> </head> <body> <form method='GET' action='test_autocomplete.html'> <input type='text' id='username' name='username'> <br> <input type='password' id='password' name='password'/> <br> <a href='javascript:submitForm();'>Submit</a> <br> <input type='submit'/> </form> </body> </html>
The href link doesn’t get the prompt but the submit button will in IE7. Both work in Firefox.
I can’t get the style of my site to look the same with a submit button, Does anyone know how to get the remember password prompt to show up when submitting via Javascript?
Why not try hooking the form submission this way?
That way your function will be called whether the link is clicked or the submit button is pushed (or the enter key is pressed) and you can cancel the submission by returning false. This may affect the way IE7 interprets the form’s submission.
Edit: I would recommend always hooking form submission this way rather than calling submit() on the form object. If you call submit() then it will not trigger the form object’s onsubmit.