I thought that I understood something that I obviously don't !
It regards the usage of custom forms in order to customize the login table generated ( or serialized by web2py )
My objective is to place a different login form ( with different table settings ) in a 100px in height of a header ( similar to facebook ).
( this is an initiative to port a completely working and nice looking local working php & html app to web2py - it was done with my own branded grid system of 20 columns ) !
PS. my equivalent layout.html is main_tpl.html
I have set up a test.html in the default view to try out different things with "custom form in conjunction with SQLFORM from the default.py controller and most have been successfull ". except the following :
This is what I have done and it is not working ! Please help !
in the controller ( default.py ) :
def test(): form=SQLFORM(auth.login(),hideerror=True) return dict(form)in the default view folder ( test.html ) :
{{extend 'main_tpl.html'}} <h1>This is the test.html template</h1> {{if form.errors:}} Your submitted form contains the following errors: <ul> {{for fieldname in form.errors:}} <li>{{=fieldname}} error: {{=form.errors[fieldname]}}</li> {{pass}} </ul> {{form.errors.clear()}} {{pass}} <div class="col-12 last" id="toplogon"> {{=form.custom.begin}} <table width="100%" border="0"> <tr> <td> {{=form.custom.label.email}} <input name="email" type="text" class="string" id="auth_user_email" value="" /> </td> <td> {{=form.custom.label.password}} <input class="password" id="auth_user_password" name="password" type="password" class="field" value="" /> </td> <td><br /><input name="submit" type="submit" class="nice tiny button radius" style="font-style:normal;font-size:14px;" value="{{=T('Log In »')}}" /></td> </tr> <tr> <td class="left"> <label><input class="checkbox" id="auth_user_remember" name="remember" type="checkbox" value="on" />{{=T('Remember me')}}</label> </td> <td><a href="{{=URL('default','/user/request_reset_password')}}">{{=T('Forgot password?')}}</a></td> </tr> </table> {{=form.custom.end}} </div>
It is not working as expected and i cannot find the bug .. please help ... can someone please advise me what am I doing wrong .. what am I missing !??? ... thank you
Don
0
anthony 12 years ago
form=SQLFORM(auth.login(),hideerror=True)
That will not work. auth.login() itself returns a form (it also handles the processing of the form), so you cannot pass it to SQLFORM. Instead, just do:
auth.settings.hideerror = True
form = auth.login()
return dict(form=form)
replies (1)