Hmm, so it sounds like components with multiple buttons are basically not supported easily. I am writing an application to control a bunch of scientific equipment. For each piece of equipment I was planning to make one component to monitor and control it, and then put all these components on one web page. Most of the controls make sense to implement as buttons. Does anyone have a suggestion of a better way to organize such an application to play better with web2py etc.? Thanks again, G
On Aug 3, 10:43 pm, Anthony <[email protected]> wrote: > Forms in ajax components and non-ajax components with ajax_trap=True are > submitted via ajax, and the form variables are serialized via the jQuery > .serialize() method. As explained here (http://api.jquery.com/serialize/), > the .serialize() method doesn't know what triggered the form submission, so > it cannot include the values of any submit buttons. For now, here is one > possible workaround using a hidden > field:http://forum.jquery.com/topic/submit-event-serialize-and-submit-butto.... > Perhaps we can come up with a more general solution. > > Anthony > > On Wednesday, August 3, 2011 11:46:09 PM UTC-4, G wrote: > > Hello, > > I am trying to make a simple component which has a form that contains > > just buttons. It seems to work OK when I use LOAD(... ajax=False) and > > have only one component on my page. However, I'd like to have multiple > > components on one page. When I tried that, still with ajax=False, > > everything looks OK, but the form doesn't do anything (that is, the > > action that's supposed to happen when a button is pushed never > > happens). Similarly, if I set ajax=True, the same problem occurs (no > > action). > > I then tried setting ajax_trap = True after which when I click a > > button in the component, the component disappears and the text > > "invalid request" appears. I found this very difficult to debug, but > > finally by putting a print statement in the rewrites.py file I found > > that the path that was trying to be accessed looks as follows, from > > which it's why it is an invalid request: > > > /devel/default/(<gluon.html.XML object at 0x14721510>,) > > > What is the correct way to have multiple components with simple > > customized forms on a single page? > > > The simple component I am using has the following function which uses > > the generic.load: > > > def inits(): > > obs = _getObs() > > form = FORM(TABLE(TR(TD(TAG.BUTTON("Reset > > Receiver",_type="submit",_name="initRSS", _value="yes")), > > TD(TAG.BUTTON("Reset DSP",_type="submit",_name="initDSP", > > _value="yes")), > > TD(TAG.BUTTON("Auto Level",_type="submit",_name="autoLevel", > > _value="yes")), > > TD(TAG.BUTTON("Auto Equalize",_type="submit",_name="autoEQ", > > _value="yes"))))) > > if form.accepts(request.vars,session): > > if request.vars.initRSS == 'yes': > > print "init RSS" > > obs.simpleRSSSetup() > > if request.vars.initDSP == 'yes': > > print "init DSP" > > obs.simpleDSPSetup() > > if request.vars.autoLevel == 'yes': > > print "autoLevel" > > obs.autoLevel() > > if request.vars.autoEQ == 'yes': > > print "autoEQ" > > obs.autoEQ() > > return dict(form=form) > > > I have a second similar component. I include them both in the larger > > page as: > > {{=LOAD('default','inits.load')}} > > {{=LOAD('default','posControl.load')}} > > > Thank you for any suggestions on how to make this work. > > G > >

