thank you, i solve the problem like this:
def index():
form = auth.login()
form.elements('input',_type='submit')[0]['_Onclick']='login();return
false;'
return dict(form=form)
def login():
if not auth.login_bare(request.vars.email,request.vars.password):
return 'login failed'
form=auth.login()
if auth.user : return 'logged'
return dict(form=form)
and in the index view:
<div id='login_result'></div>
{{=form}}
<script>
function login(){
alert('here');
$.ajax({
type: "POST",
url: '{{=URL('default','login')}}',
data: $('form').serialize(),
success : function(data){
if (data != 'True'){
$('#login_result').addClass('alert
alert-error').text('Email Or password were wrong! Please try again.');
} else {
}
}
});
return false;
}
</script>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.