[support] multiple buttons with same #value D5

Metzler, David metzlerd at evergreen.edu
Wed Mar 25 19:29:09 UTC 2009


A little known fact...  You can create containers in the forms array
that have no visual representation in the form, kind of like fieldsets,
but without the fieldset. 

While (...) {
  $form[$id] = array('#tree' => TRUE); 
  $form[$id]['qty'] = array(....); 
  $form[$id]['add'] = array(....); 
}

Might clean up some of the code you've discovered. 

I usually nest all the  rows into a single fieldset as well, but that's
optional. 

Dave
 

-----Original Message-----
From: support-bounces at drupal.org [mailto:support-bounces at drupal.org] On
Behalf Of Ivan Sergio Borgonovo
Sent: Wednesday, March 25, 2009 8:56 AM
To: support at drupal.org
Subject: Re: [support] multiple buttons with same #value D5

On Wed, 25 Mar 2009 16:32:10 +0100
Ivan Sergio Borgonovo <mail at webthatworks.it> wrote:

I had to resort to some Web 1.5 techniques

 	$form['add'][$id]=array(
 //		'#type'=>'button',
 		'#type'=>'submit',
		'#name'=>$id.'-add',
 		'#value'=>t('Add'),
 	);
 }

roll over qty

foreach($form_values['qty']...
  if($form_values[$key.'-add']==t('Add');

Did things get better in D5+?

--
Ivan Sergio Borgonovo
http://www.webthatworks.it

--
[ Drupal support list | http://lists.drupal.org/ ]


More information about the support mailing list