[development] Forms API and multiple submit buttons

Syscrusher syscrusher at 4th.com
Tue Nov 21 02:04:07 UTC 2006

On Monday 20 November 2006 03:42, Rob Barreca wrote:
> >
> > I need a way to determine which button was the one actually pressed.
> In Drupal 5.0 you should be able to do something like if 
> ($form_values['op'] == t('Button text')) {... (was only $_POST['op'] in 
> 4.7 IIRC) in _validate and _submit to find which button was pressed.

Aha! I was missing the fact that you specifically have to test for "op" and not
the fieldname of the button. I had seen the reference to $_POST['op'] in the code
from node.module that I used as an example, but I just assumed they were naming
their submit button "op". I didn't realize it was a special case.



Syscrusher (Scott Courtney)          Drupal page:   http://drupal.org/user/9184
syscrusher at 4th dot com            Home page:     http://4th.com/   

More information about the development mailing list