It's going to take some time to digest this, especially the onxxx=lambda part. When would you use the embedded form rather than the controller/view combination above? Are there any examples of the either (or both) the these? If not, once I understand this better, I'd be happy to contribute to the documentation.
Thanks again, Gary On Apr 27, 6:31 pm, mdipierro <[email protected]> wrote: > when you call crud you can also specify lots of options... > > def mycreate(): > return dict(form=crud.create(db.mytable,next=URL > (...),onaccept=lambda form:pass,onvalidation=lambda form: pass)) > > and more. You can also embed them in views > > {{=crud.create(db.mytable)}} > > Massimo > > On Apr 27, 5:23 pm, Gary <[email protected]> wrote: > > > Massimo, > > > Thank you, Thank you, Thank you! This clarified so much and makes a > > great deal of sense. > > > Kindest regards, > > Gary > > > On Apr 27, 5:48 pm, mdipierro <[email protected]> wrote: > > > > On Apr 27, 3:14 pm, Gary <[email protected]> wrote: > > > > > Like myapp/default/display_manual_form() in the book, right? > > > > > Two questions. I assume that I need a: > > > > > def data(): return dict(form=crud()) > > > > > for each table that uses the crud controller to properly define the > > > > URL. If that's true, it's the part that I missed. > > > > No. This controller will work for every table in the database. In > > > fact, as you do below, you specify the table in the URL > > > > > 1)http://hostname/myapp/default/data/update/person/2 > > > > You create a CRUD action per table > > > > def mycreate(): > > > return dict(form=crud.create(db.mytable)) > > > > or an update action > > > > def myupdate(): > > > id=request.args[0] > > > return dict(form=crud.update(db.mytable,id)) > > > > > or create a controller like: > > > > > 2) def update1(): > > > > redirect(URL(r=request,f='data/update/person/2')) > > > > Do do not do actions that just redirect. > > > > > In either case, what should the view be named? > > > > the view is the controller/action.html > > > > > Since one might want > > > > to have a different view for read,update,delete,etc., it seems that it > > > > should be: > > > > > default/data/update.html, but my testing seems to work at default/ > > > > data.html. > > > > you can do > > > > def data(): > > > response.view="%s/%s/%s.html" % (request.controller, > > > request.function, request.args[0]) > > > return dict(form=crud()) > > > > > That seems to imply that using method #2 above with a response.view() > > > > would be the better solution. Would you agree with that conclusion or > > > > is there a better way to handle this? > > > > > Thank you. > > > > Gary > > > > > On Apr 26, 9:22 pm, mdipierro <[email protected]> wrote: > > > > > > Yes, you can make the form in html as usual for SQLFORM. > > > > > > On 26 Apr, 18:37, Gary <[email protected]> wrote: > > > > > > > Is there a simple way to replace the automatically generated SQLFORM > > > > > > in the various crud controllers with a custom SQLFORM? > > > > > > > Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" 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 -~----------~----~----~----~------~----~------~--~---

