Hi guys Thanks a lot.
Maurice On Sep 20, 3:20 pm, Iceberg <[email protected]> wrote: > On Sep20, 12:48pm, Iceberg <[email protected]> wrote: > > > > > > > On Sep20, 11:57am, weheh <[email protected]> wrote: > > > > OK, here's a way to do it: > > > > {{=form.custom.begin}} > > > <button style="border: 1px solid blue;" type="submit" > > > name="process">Process</button> > > > <input value="default" type="hidden" name="myform" /> > > > {{=form.custom.submit}} > > > {{=form.custom.end}} > > > > Then, when you press the process button, the request.vars.process will > > > not be None. > > > Interesting. But is this trick universally reliable, or just depends > > on different browsers? > > > Searching on the web and I confirmed my suspicion. This old post > > mentioned "IE not sending the name/value pair for the submit button > > when Enter was pressed after filling in a field in the form." And my > > test confirmed that it is still the case even in today's IE7, which is > > still the majority of browser in the market, > > huh?http://muffinresearch.co.uk/archives/2005/12/08/fun-with-multiple-sub... > > > So I think we should not rely on this trick. If you really need > > multiple submit buttons, try some javascript technique mentioned in > > following post, although that way we need multiple actions in our > > controller, which is not DRY enough. > > :-/http://www.phpbuilder.com/board/showthread.php?t=10248489 > > Correction. Proper javascript technique will NOT result in multiple > actions. We can still use one action to handle multiple relevant > submits. The point is to use multiple normal button to mimic multiple > submit button, yet still using only one real submit target. > > def test(): > form=FORM( > INPUT > (_type='hidden',_name='action',_id='action',_value='undefined'), > INPUT(_type='button',_value='Do something',_onclick=''' > this.form.action.value=1;this.form.submit(); > ''',), > INPUT(_type='button',_value='Do something else',_onclick=''' > this.form.action.value=2;this.form.submit(); > ''',), > ) > if form.accepts(request.vars): > response.flash='You clicked button %s'%request.vars.action > return {'':form} > > Regards, > Iceberg- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" 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 -~----------~----~----~----~------~----~------~--~---

