[Zope-dev] "Dispatch" argument solving submit button problem

Clemens Robbenhaar zope-dev@zope.org
Mon, 14 Apr 2003 21:40:44 +0200


Hi Johan,

 a possibly very stupid question:

 > So:
 > <form method="dispatcher_url">
 > <input type="submit" name="do_this:dispatcher" value=" Do This ">
 > </form>
 > 
 > would add REQUEST['dispatcher']='do_this'

and 

<form action="dispatcher_url">
<input type="submit" name="this_one" value=" Do This ">
</form>

currently adds  REQUEST['this_one']=' Do This '

thus instead of:
 > 
 > This would then be easy for the dispatcher method at 'dispatcher_url'
 > to handle in a if-else structure (etc):
 > 
 > if REQUEST['dispatcher']=='do_this':
 >      return self.do_this()
 > elif REQUEST['dispatcher']=='do_that':
 >      return self.do_that()
 > else:
 >      return self.just_show_it()
 > 

one could say:

  if REQUEST.get('this_one',None):
      return self.do_this()
  elif REQUEST.get('that_one',None):
      return self.do_that()
  else:
      return self.just_show_it()

Maybe I have overlooked something, but it looks like the functionality
can be obtained with the current implementation without adding 
one more magic ':', doesn't it?

just asking,
Clemens