I found a workaround to solve this issue by closing the form tag myself : I removed the line :
> {{ =login_form.custom.end }} And replaced it with : > <input name="_formname" type="hidden" value="login"> > It IS a monkeypatch, and it comes with restrictions (regarding components for instance) but at least my problem is solved for now. On Thursday, April 17, 2014 8:31:57 PM UTC+2, Louis Amon wrote: > > I'm trying to build an Ajax-based login form using web2py's LOAD() helper. > > I made a controller named 'users.py', in which I defined a 'signin()' > function : > >> def signin(): >> form=auth.login() >> if form.process(formname=None).accepted: #hideerrors=True >> response.flash = 'form accepted' >> print form.vars >> elif form.errors: >> print form.errors >> return dict(login_form=form) > > > The corresponding view ('users/signin.load') is as follows: > >> <h2 class="form-login-sign-up_title">S'identifier</h2> >> <p class="form-login-sign-up_subtitle">J'ai déjà un compte</p> >> {{ =login_form.custom.begin }} >> {{ =login_form.custom.widget.email }} >> {{ =login_form.custom.widget.password }} >> {{ =login_form.custom.end }} > > > Now if I go to the url : [...]/users/signin.load, my form displays > correctly but validation doesn't occur upon submitting the form. It's as > though the displayed form isn't linked to the one defined in the controller. > > > After some research, I found that if I change my view to > >> {{=login_form}} > > > Then validation occurs correctly. My form isn't customized correctly > though (obviously). > > Further research indicates that, using the first view, the rendered html > code actually contains two signatures for the FORM (just before the </form> > tag): > >> <div style="display:none;"> >> <input name="_next" type="hidden" value="/"> >> <input name="_formkey" type="hidden" >> value="c33c0072-ac25-461f-8e37-0ba48cc53dc2"> >> </div> > > > And: > > <div style="display:none;"> >> <input name="_next" type="hidden" value="/"> >> <input name="_formkey" type="hidden" >> value="553bae82-7864-4620-93ee-d54eeea366bf"> >> <input name="_formname" type="hidden" value="login"> >> </div> > > > > My guess is that, having two different signatures, web2py gets confused > about how to manage this form. > I tried several things like putting "formname=None" in the process() > function, but the only way I got my ajax component to work so far is by not > customizing my form. > > Any workaround ? > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.