Hello thanks Massimo for the note... But I can't make it work... the
change_password() doesn't change the value in the DB... So I tried
other function just to test like "register()" and in this case i even
have an error message saying "TypeError: list objects are
unhashable"... I really don't know what I'm doing wrong up here...
Below it's the controller and view... Please let me know if you have
any idea...

#################
#View "index.html"
#################
.....
.....
{{=LOAD('default','register',ajax_trap=True)}}
.....
.....
###################
#Controller: "default.py"
###################
def register():
   next = URL(r=request,f='index')
   return auth.register(onaccept=lambda form:
response.headers.update({['web2py-component-
command']:"document.location='%s'"%next}))

def otherAction():
   .....
   .....
   return dict(..........)

def index():
   return (register = register(), otherAction=otherAction())



#########################
# Here is the error message
########################
Traceback (most recent call last):
  File "gluon/restricted.py", line 173, in restricted
  File "C:/Documents and Settings/YannickT/web2py/applications/events/
controllers/default.py", line 70, in <module>
  File "gluon/globals.py", line 96, in <lambda>
  File "C:/Documents and Settings/YannickT/web2py/applications/events/
controllers/default.py", line 27, in register
  File "gluon/tools.py", line 1271, in register
  File "C:/Documents and Settings/YannickT/web2py/applications/events/
controllers/default.py", line 27, in <lambda>
TypeError: list objects are unhashable



Thanks for your help,
Yannick P.

On Mar 24, 10:17 pm, mdipierro <[email protected]> wrote:
> My bad
>
> auth.change_password(onaccept=lambda form:
> response.headers.update({'web2py-
> component-command']:"document.location='%s'"%next}))
>
> On Mar 24, 8:21 pm, Yannick <[email protected]> wrote:
>
>
>
> > Sorry but I have a lot of syntax error in the action:
>
> > auth.change_password(onaccept=lambda form: response.headers['web2py-
> > component-command']="document.location='%s'"%next))
>
> > I don't seems to see why... Please let me know if you see it...
> > Thanks,
>
> > On Mar 24, 2:00 pm, mdipierro <[email protected]> wrote:
>
> > > ###################################################
> > > <script>
> > >   $("#pwdChangeForm").submit(function(){
> > >    url={{=URL(r=requet, f="changePwd")}};
> > >    ids = ['currentpwd', 'pwd1', 'pwd2'];
> > >    ajax(url, ids, 'confirmationMsg');   # This is the Ajax method that
> > > is coming with Web2py
> > >    return false;
>
> > > });
>
> > > </script>
>
> > > In view:
> > > {{=LOAD('defualt','changePwd',ajax_trap=True)}}
>
> > > ######################################
> > > # Action: (Here I want to use the Auth method named change_password. )
> > > ##############################
> > > def changePwd:
> > >    next = URL(r=request,f='index')
> > >    return auth.change_password(onaccept=lambda form:\
> > >        response.headers['web2py-component-
> > > command'="document.location='%s'" % next)
>
> > > On Mar 24, 12:22 pm, Yannick <[email protected]> wrote:
>
> > > > Ok here is a view form to change user password:
> > > > ###################################################
> > > > <script>
> > > >   $("#pwdChangeForm").submit(function(){
> > > >    url={{=URL(r=requet, f="changePwd")}};
> > > >    ids = ['currentpwd', 'pwd1', 'pwd2'];
> > > >    ajax(url, ids, 'confirmationMsg');   # This is the Ajax method that
> > > > is coming with Web2py
> > > >    return false;});
>
> > > > </script>
>
> > > > <div id="confirmationMsg"></div>
> > > > <form id="pwdChangeForm"  method="post">
> > > >     Current password:    <input type="password" id="currentpwd"
> > > > name="currentpassword">
> > > >     new password:         <input type="password" id="pwd1"
> > > > name="password1">
> > > >     Old password:          <input type="password" id="pwd2"
> > > > name="password2">
> > > >     <input type="submit" value="Submit">
> > > > </form>
> > > > ######################################
> > > > # Action: (Here I want to use the Auth method named change_password. )
> > > > ##############################
> > > > def changePwd:
> > > >    return auth.change_password()
>
> > > > So basically from the action I wanted to be able to know when the form
> > > > is validated and return a confirmation that will be display through
> > > > AJAX. I hope you understand what I mean here... Instead of returning a
> > > > form, I want to return a string that represent a success or an Error
> > > > message... How can I do that without the need to create my how code to
> > > > change the password . Thanks!
>
> > > > Yannick P.
>
> > > > On Mar 24, 12:11 pm, mdipierro <[email protected]> wrote:
>
> > > > > show us your action and explan how you want it to behave in details,
> > > > > and I can post an example.
>
> > > > > On Mar 24, 11:06 am, Yannick <[email protected]> wrote:
>
> > > > > > Sorry I really don't understand... I have to code my own Auth 
> > > > > > function
> > > > > > like "register(), login() etc..." it that what you meant ?
>
> > > > > > Yes I know I have to create my own action but I wanted to re-use the
> > > > > > Auth Api function by calling them inside my action...
> > > > > > So basically what you are saying is that i can't do it that way ?
>
> > > > > > Please let me know if I'm missing something here...
>
> > > > > > Thanks a lot,
> > > > > > Yannick P.
> > > > > > On Mar 24, 11:16 am, mdipierro <[email protected]> wrote:
>
> > > > > > > You should make your own action and use {{=LOAD(..)}}
>
> > > > > > > On Mar 24, 9:32 am, Yannick <[email protected]> wrote:
>
> > > > > > > > Hello mate,
> > > > > > > > This can be an easy question but I don't know how to used the 
> > > > > > > > Web2py
> > > > > > > > "Ajax (u,s,t)" function to call build-in Web2py Authentication 
> > > > > > > > API.
> > > > > > > > It's there any example ?...
>
> > > > > > > > There is a cool example using JDiv:
> > > > > > > >  def register():
> > > > > > > >     return auth.register(onaccept=lambda form: jDiv.flash('try
> > > > > > > > login'))
>
> > > > > > > > This is cool BUT I DON'T want to use jDiv...
> > > > > > > > How can I do the same without using JDIV... But instead i want 
> > > > > > > > to use
> > > > > > > > AJAX(u,s,t){} function just like any other form that use Ajax 
> > > > > > > > function
> > > > > > > > to send value ( The only difference here is the fact that I'll 
> > > > > > > > send
> > > > > > > > value to already build Auth API like auth.register(),
> > > > > > > > auth.password_change(), auth.login() etc... )
>
> > > > > > > > Please let me know if you have any hints.
>
> > > > > > > > Yannick P.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to