Div click and AUTOCOMPLETE password dialog problem
- by ticky
And what if you want to autocomplete passwords? I am using similar thing here... I am using Div (id=loginButton) and it has some image - I don't want button control in MVC application (), neither image button. I have hidden input control which is hidden button actually (id=submit_btn).
So, on div's (id=loginButton) click, I want to call hidden input control (id=submit_btn) and it's submit action.
HTML:
<div id="loginButton" > </div>
<input type="submit" style="display:none" name="submit" id="submit_btn" />
And JQuery:
$(document).ready(function() {
$('#loginButton').click(function() {
$('#LoginForm').submit();
});
$("form[action$='HandleLoginForm']").submit(function() {
Login();
return false;
});
return false;
});
Function Login() is working with Ajax, without downloading file dialog, but I need also auto complete passwords dialog.
function Login() {
var urlData = $("#LoginForm").serialize();
if (returnUrl != "") {
urlData = $("#LoginForm").serialize() + "&returnUrl=" + returnUrl;
}
$.ajax({
url: $("#LoginForm").attr("action"),
type: "POST",
data: urlData,
dataType: "json",
success: function(result) {
if (result.Content != null) {
if (result.Valid) {
window.location = result.Content.toString();
}
else {
document.body.innerHTML = result.Content.toString();
}
}
}
});
return false;
}
It is easy when you use only
<input type="submit">
instead of DIV. Form knows that it is for auto completing passwords, but if I use div and force hidden button click like in the code from below, it doesn't show autocomplete password dialog.
$('#submit_btn').click();
It will not work. User is logged in, but no reminding for browser to store password.
I need this.