mardi 24 février 2015

javascript - remember user data after loggin in and checkbox selected

I'm helping developing improvements on a client website. In one of those improvements, there is the Login form. I want to add a checkbox that when the user logs in after selecting this checkbox, it remember his login data.


The login form I have:



<form id='formLogin' method='post' name='formLogin'> <!-- action="telaInicial"> -->
<label for="usuario">{label_index_user}</label><input name="usuario" id="usuario" type="text" /><br />
<label for="senha">{label_index_password}</label><input name="senha" id="senha" type="password" maxlength="8" /><br />
<div id="btLogin"><input type='button' id='entrar' value="{label_index_enviar}"/></div>
<div id="btLogout"><input type='button' id='deslogar' value="{label_index_sair}"/></div>
<br><div id="checkLembraDados"><input type='checkbox' id='lembrar' />{label_index_lembrardados}</div>
<a id="esqueciSenha" href='#' >{label_index_esquecisenha}</a>
</form>


So I think I need to put on my JS file something like:



$("#lembrar").click(function() {
if document.getElementById("lembrar").checked = true {
// CODE FOR REMEMBERING DATA FOR FUTURE LOGINS
}
});


I don't know if I made myself clear on this question. But I think it can be simple to put on the page.


Thanks for any help.





Aucun commentaire:

Enregistrer un commentaire