Actually all buttons in a Drupal form have the name "op" so that you can easily determine which button was pressed in the submit function. i.e. if ($op = 'blah) or switch ($op).<br><br>If you are using the Drupal Ahah framework for this then your submit function should handle it. But since all your buttons are titled Remove, what you can do is use $form_state['clicked_button']['#id'] to determine which button was clicked in your submit function. As #id is built of the array key you give the element in the $form variable.<br>
<br clear="all">-----<br>Adam A. Gregory<br>Drupal Developer & Consultant<br>Web: AdamAGregory.com<br>Twitter: <a href="http://twitter.com/adamgregory">twitter.com/adamgregory</a><br>Phone: 910.808.1717<br>Cell: 919.306.6138<br>
<br><br><div class="gmail_quote">On Wed, Jun 23, 2010 at 11:15 AM, Ken Winters <span dir="ltr"><<a href="mailto:kwinters@coalmarch.com">kwinters@coalmarch.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Does it have to be a giant form? Using anchor tags and then a confirm form is fairly common.<br>
<br>
Objects in a form do need to have unique names / IDs.<br><font color="#888888">
<br>
- Ken Winters</font><div><div></div><div class="h5"><br>
<br>
On Jun 23, 2010, at 10:36 AM, Richard Morse wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi! I'm trying to build an AHAH form which allows users to add and remove steps.<br>
<br>
I'm building a table like:<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Id Note<br>
----------------------------------------------<br>
1 [This is a step ] <remove><br>
2 [This is another step ] <remove><br>
3 [Make me an offer! ] <remove><br>
<br>
<add step><br>
</blockquote>
<br>
In order to be able to determine which remove button was pressed, I'm creating them like:<br>
<br>
array(<br>
'#type' => 'button',<br>
'#name' => 'remove_btn_' . $row_id,<br>
'#value' => 'remove',<br>
'#ahah' => ...<br>
)<br>
<br>
I'm doing this because otherwise the form state shows the clicked_button always as the last of the remove buttons created.<br>
<br>
According to the forms_api_reference on <a href="http://api.drupal.org" target="_blank">api.drupal.org</a>, in the section for '#name',<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
All button and submit elements on a form should have the same name<br>
</blockquote>
<br>
Am I breaking something by setting the name for each button separately? If so, how am I supposed to distinguish between the various remove buttons?<br>
<br>
Thanks,<br>
Ricky<br>
<br>
<br>
The information in this e-mail is intended only for the person to whom it is<br>
addressed. If you believe this e-mail was sent to you in error and the e-mail<br>
contains patient information, please contact the Partners Compliance HelpLine at<br>
<a href="http://www.partners.org/complianceline" target="_blank">http://www.partners.org/complianceline</a> . If the e-mail was sent to you in error<br>
but does not contain patient information, please contact the sender and properly<br>
dispose of the e-mail.<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br>