Also if I remove the controller's flash line i.e. my new controller is: Controller: default.py def register(): form=auth.register() form.add_button('Cancel', URL('register')) return dict(form=form) Still it doesn't work.... i.e. it redirects to register.html with the data entered(which I filled in before clicking on register button).... and doesn't enter it into the database.....
On Thursday, January 2, 2014 8:55:07 PM UTC+5:30, Anthony wrote: > > Sorry, hadn't looked closely at the controller code. First, your first two > lines are useless, as the third line simply overwrites the "form" variable > with a completely new object. Second, auth.register() already handles the > form processing, so you cannot subsequently call form.accepts(). If you > want to control the flash messages, use the auth.messages object to set > them. > > Anthony > > On Thursday, January 2, 2014 5:30:54 AM UTC-5, Akash Agrawall wrote: >> >> Thanks for marking that error..... but after changing that also same >> error..... :( .... it's urgent... >> >> On Tuesday, December 31, 2013 8:33:54 PM UTC+5:30, Anthony wrote: >>> >>> At the end of the form, you have {{=form.custom.begin}}, but it should >>> be {{=form.custom.end}}. >>> >>> On Tuesday, December 31, 2013 7:24:34 AM UTC-5, Akash Agrawall wrote: >>>> >>>> Hie folks..... When I click on submit button of the CUSTOM REGISTRATION >>>> form..... it redirects to the same page...... ?? No idea what this is >>>> about...... >>>> Controller: default.py >>>> def register(): >>>> form=auth.register() >>>> form.add_button('Cancel', URL('register')) >>>> form=auth.register() >>>> if form.accepts(request.vars,session): >>>> print "did it" >>>> response.flash="Your Registration request has been >>>> successfully submitted" >>>> redirect(URL('home')) >>>> elif form.errors: >>>> response.flash="Errors in form" >>>> else: >>>> response.flash="nothing mah badd" >>>> return dict(late=late, form=form) >>>> >>>> View: register.html >>>> {{extend 'layout.html'}} >>>> <a href={{=URL('home')}}>Home</a> ยป Book Connect >>>> <p style="font-family:Times New Roman;font-size:17px;"> >>>> We facilitate sharing of books with partner Schools, NGOs, community >>>> centers, and shelter homes. >>>> <br/><br/> >>>> In case you represent any of the above, please register with us as >>>> partner to avail our book sharing program BookConnect. Once registered >>>> with >>>> us, you can search through our book repository and request for the books. >>>> </p> >>>> <br/> >>>> {{=form.custom.begin}} >>>> <table> >>>> <tr> >>>> <td style="width:51%;">Name <span >>>> style="color:red;">*</span></td><td> {{=form.custom.widget.Name}}</td> >>>> </tr> >>>> <tr> >>>> <td style="width:51%;">Email <span >>>> style="color:red;">*</span></td><td> {{=form.custom.widget.email}}</td> >>>> </tr> >>>> <tr > >>>> <td style="width:51%">Password <span >>>> style="color:red;">*</span></td><td> {{=form.custom.widget.password}}</td> >>>> </tr> >>>> <tr> >>>> <td style="width:45%">Address <span >>>> style="color:red;"></span></td><td> {{=form.custom.widget.Address}}</td> >>>> </tr> >>>> <tr> >>>> <td style="width:45%">Contact Person <span >>>> style="color:red;"></span></td><td>{{=form.custom.widget.Contact_person}}</td> >>>> </tr> >>>> <tr> >>>> <td style="width:45%">Contact No 1 <span >>>> style="color:red;">*</span></td><td>{{=form.custom.widget.Contact_No_1}}</td> >>>> </tr> >>>> <tr> >>>> <td style="width:45%">Contact No 2 <span >>>> style="color:red;"></span></td><td>{{=form.custom.widget.Contact_No_2}}</td> >>>> </tr> >>>> <tr> >>>> <td style="width:45%">Description <span >>>> style="color:red;"></span></td><td>{{=form.custom.widget.Description}}</td> >>>> </tr> >>>> <tr> >>>> <td >>>> style="width:45%">Website </td><td>{{=form.custom.widget.Website}}</td> >>>> </tr> >>>> <tr> >>>> <td style="width:40%">Date of >>>> Request</td><td>{{=form.custom.widget.Date_of_request}}</td> >>>> </tr> >>>> <tr style="visibility:hidden"><td >>>> style="width:40%">Status</td><td>{{=form.custom.widget.Date_of_request}}</td></tr> >>>> <tr><td>{{=form.custom.submit}} >>>> <!--a class="btn btn-default" >>>> href={{=URL('donate_book')}}>Cancel</a--></td></tr> >>>> </table> >>>> {{=form.custom.begin}} >>>> >>>> >>>> print form.errors -> <Storage {}> >>>> pritn form.accepts(request.vars,session) -> false >>>> >>> -- 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/groups/opt_out.