0

I have a form with login button. When I click on Login Button I am showing a login dialog.

Here it is the code:

if (typeof window.loginDialogObj === 'undefined') {
    var registerAddress = jQuery('#registerAddress');
    var forgotURL = jQuery('#forgotURL');
    var formHTML = "<div id='loginDialogDiv'>" +
                "   <div id='loginDialogText'>" + pageDictionaryTranslated.LoginDialogText + "</div>" +
                "   <div class='loginTitle'>Username</div> <input id='username' name='username' type='text'><span id='LoginUsernameValidator' style='display:none' class='asterix'>*</span><br/><br/>" +
                "   <div class='loginTitle'>Password</div> <input id='password' name='password' type='password'><span id='LoginPasswordValidator' style='display:none' class='asterix'>*</span><br/>" +
                "   <input id='password' type='hidden' value='test'><br/>" +
                "   <div class='loginDialogMessageContainer'><div id='loginDialogMessage' style='display:none' class='error-input ui-corner-all'></div><div class='clear'></div></div>" +
                "   <div class='forgot'><a href='" + forgotURL.val() + "'>" + pageDictionaryTranslated.LoginDialogForgotPassword + "</a><br/><a id='RegisterButton' href='" + registerAddress.val() + "'>" + pageDictionaryTranslated.ButtonRegister + "</a><br/></div>" +
                "   <div class='popupButton button buttonLogin' id='loginDialogSubmitButton' style='float:right;'><a onclick=\"javascript:DoLogin(window.loginDialogObj);return false;\" href='javascript:void(0);'>" + pageDictionaryTranslated.LoginDialogButtonLoginText + "</a></div>" +
                "</div>";
    window.loginDialogObj = jQuery(formHTML).dialog({
        title: pageDictionaryTranslated.LoginDialogTitle,
        closeOnEscape: true,
        draggable: false,
        resizable: false,
        dialogClass: 'loginModal modal',
        modal: true
    });
}
else {
    // display dialog and clear all fields
    resetFormFields(window.loginDialogObj).dialog('open');
    jQuery("#loginDialogMessage", window.loginDialogObj).html('');
}

When I click on login button I make an AJAX request then I redirect to the protected area.

The problem is that for username and password textboxes do not work autocomplete and customer comes to me with that question: "Currently we prevent the browser for autocompletion, which is felt bad by our developers. I need to enable browser autocompletion."

I need help! Any ideas what is going wrong?

Thanks in advice

1
  • you should tag your question, so that others can better answer your question. I added the 'jquery' tag, maybe you can add some more tags.
    – bmu
    Sep 28, 2012 at 8:05

1 Answer 1

0

I can't see anything within the form HTML that explicitly turns autocomplete off.

I wonder if you would get autocomplete if you placed the HTML on the page and used JavaScript to show it at the appropriate time, rather than injecting an HTML string into the page.

Update

Actually, the problem may be that there is no form - if you wrapped your inputs in a <form ...> tag the browser might be more likely to offer to remember the details.

I am assuming you mean that the browser doesn't offer to remember the user name and password?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.