why not using jquery ui tabs plugin and web2py component? Richard
On Mon, Apr 9, 2012 at 5:40 PM, Derek <[email protected]> wrote: > I'd put a warning saying "you have unsaved changes." or perhaps only allow > switching after saving. You could also make your own form, and handle > saving all changes with your controller. Web2py has good defaults, and the > helpers are good for getting a website up and running quickly, but when you > have custom logic needs, you should get your hands dirty by writing your > own code. > > > On Monday, April 9, 2012 6:19:32 AM UTC-7, Cliff wrote: >> >> Using the dog-owner model from the examples, you might have a model like >> this: >> >> db.define_table('dog', Field('dog_name')) >> db.define_table('owner', Field('owner_name')) >> db.define_table('dog_owner', >> Field('dog_id', db.dog), >> Field('owner_id', db.owner), >> Field('owner_plays_fetch_with_**dog', 'boolean) >> ) >> >> I like to use tabs to edit a relationship like this on one web page. >> >> I would use an SQLFORM or a crud form on the first tab to present the >> owner data for editing. This data gets processed in the normal way. >> >> I would put the dog data on a second tab, but use jquery ajax to handle >> changes. Maybe the dog's name changes, or the owner decides to start >> playing fetch-the-stick with the dog. >> >> The problem with this approach is that you can lose changes made on the >> owner page. If you, for example, need to edit both the owner's name and >> the dog's name, you might type the owner's new name on tab 1, move to tab 2 >> and edit the dog's name, then close the page without going back to tab 1 >> and clicking Submit. >> >> There are several possible solutions. >> >> - Put the owner and dog information on separate forms with submit >> buttons. They may or may not be on different tabs. The drawback is it >> takes a round trip to the server every time a user switches between dog >> information and owner information. >> >> - Use jquery/ajax on the owner page to record changes as they are made. >> If the user is making a lot of changes on a form, I'm not sure there is a >> good way to give feedback. >> >> - Use some kind of form-dirty javascript to remind the user to submit the >> form on the first tab if he tries to close the page while it still has >> unsaved changes. >> >> Which approach would you use, or would you handle this in a different way? >> >> Thank you. >> >

