---------------------------------------controller------ @auth.requires_login() def test(): a=request.args(0) form=SQLFORM(db.Notes).process() form.vars.TestID = a comments=db(db.Test.TestID==a).select() if form.process(formname="somename").accepted: form.vars.TestID = a redirect(URL('default','test', args=[request.args(0)])) return dict(form=form, comments=comments) -------------------------------------------------------------------test.load file------- <button id="button3" class="btn btn-danger" data-toggle="collapse" data-target="#cd" type="button" >Add note!</button> <div class="collapse" id="cd"> <h4>Add a Note</h4> {{=form}} </div> <br>
<h4>Current Comments: </h4> {{for item2 in reversed(comments):}}<li><b></b> <i>Posted on: {{=item2.created_on}} By: {{=item2.created_by.first_name}} {{=item2.created_by.last_name}}</i> <br> {{=item2.NoteSummary}} <br></li>{{pass}} ---------------------------------------------------------FOR VIEW---------- {{=LOAD('default','notestest.load',ajax=False, ajax_trap=True, args=[request.args(0)])}} On Thursday, May 8, 2014 11:05:37 AM UTC-5, Carlos Cesar Caballero Díaz wrote: > > Anthony, thanks for your answer. > > Of course, the form is submitted to the parent page... I think that I > should rest a litle and continue tomorrow... > > Thanks again for your answer > > > El 08/05/14 10:10, Anthony escribió: > > You should not set ajax_trap=False, as that will cause the form to be > submitted to the action of the parent page rather than the action of the > component. Instead, in your form processing code, if the form is accepted, > you can do a redirect to the parent page URL, which will cause that URL to > reload. > > Anthony > > On Thursday, May 8, 2014 9:50:08 AM UTC-4, Carlos Cesar Caballero Díaz > wrote: >> >> I need to reload a page when a component form is submitted, the book >> says that "ajax_trap=False indicates that forms must be submitted >> normally, thus reloading the entire page". Using "ajax_trap=False" the >> page is reloaded, but the form action is not executed (there is no new >> entry in the db table). There is my code: >> >> db.py: >> ... >> db.define_table('mytable',Field('myfield','string')) >> >> >> default.py: >> ... >> def test_component(): >> form = crud.create(db.mytable) >> return dict(form=form) >> ... >> >> >> default/test_component.load: >> {{=form}} >> >> default/index.php: >> {{ >> =LOAD('default','test_component.load',ajax_trap=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+un...@googlegroups.com <javascript:>. > For more options, visit https://groups.google.com/d/optout. > > > -- 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.