Having many small forms is actually working out pretty well, and seems to be a resonable solution. It was not intuitive to me, but I think it's just a disconnect between the way I would do things in a GUI framework versus the way things need to be done for web applications. By the way, I think it would be helpful to many people to have a tutorial that approaches web2py (or another framework) from the point of transitioning from a GUI framework to the web. As it is, the web2py book seems to assume a lot of familiarity with creating web applications and less familiarity with Python. I imagine several people like me are in the opposite situation. Thanks for the help and the great work, G
On Aug 5, 3:34 am, Massimo Di Pierro <[email protected]> wrote: > I know. They were just regular good practice suggestions. Sorry. Will > look for a solution. > > On Aug 4, 6:44 pm, G <[email protected]> wrote: > > > Hi Massimo, > > Thank you for the suggestions. I have implemented both, but neither > > helps with the original problem of having components with multiple > > buttons work with ajax=True. My new controller generates several forms > > each with just one button and with distinct formnames. It has an if > > form.accepts clause for each form to do the required action, and then > > returns all the forms to the view to be properly formatted. It seems a > > bit clumsy, but also seems to be working. > > Thanks again, > > G > > > On Aug 4, 4:36 pm, Massimo Di Pierro <[email protected]> > > wrote: > > > > if you do not need a view and your component only displays the form > > > you can just "return form" and pypass the generic view. It will be > > > faster. I also suggest you use ajax=True. Always call the component > > > directly as a test that it is working. > > > > On Aug 4, 6:33 pm, G <[email protected]> wrote: > > > > > I think I found a workable (but slightly annoying) solution: create > > > > several mini-forms that only have the submit button, each with a > > > > different form name. Then I can just use many > > > > if form_blah.accepts(request.vars, session, formname='form_blah'): > > > > clauses. I'd still be interested in knowing if there is a better way. > > > > Another idea I toyed with was using jQuery to connect the .click > > > > action of a button to cause a jQuery.post(URL('myfunction'), > > > > {button_name : "yes"}) to send the button press to myfunction, but I'm > > > > new to jQuery, so didn't put much time into trying it and don't know > > > > if it would work. > > > > Thanks, > > > > G > > > > > On Aug 4, 2:23 am, pbreit <[email protected]> wrote: > > > > > > Coupla other > > > > > approaches:http://www.johnnycode.com/blog/2010/04/08/jquery-form-serialize-doesn...... > > > > > > I'm surprised Jquery doesn't provide better support for this. Seems > > > > > like a > > > > > common pattern. > >

