[development] Changing button #name?
Ken Winters
kwinters at coalmarch.com
Wed Jun 23 15:15:24 UTC 2010
Does it have to be a giant form? Using anchor tags and then a confirm
form is fairly common.
Objects in a form do need to have unique names / IDs.
- Ken Winters
On Jun 23, 2010, at 10:36 AM, Richard Morse wrote:
> Hi! I'm trying to build an AHAH form which allows users to add and
> remove steps.
>
> I'm building a table like:
>
>> Id Note
>> ----------------------------------------------
>> 1 [This is a step ] <remove>
>> 2 [This is another step ] <remove>
>> 3 [Make me an offer! ] <remove>
>>
>> <add step>
>
> In order to be able to determine which remove button was pressed,
> I'm creating them like:
>
> array(
> '#type' => 'button',
> '#name' => 'remove_btn_' . $row_id,
> '#value' => 'remove',
> '#ahah' => ...
> )
>
> I'm doing this because otherwise the form state shows the
> clicked_button always as the last of the remove buttons created.
>
> According to the forms_api_reference on api.drupal.org, in the
> section for '#name',
>
>> All button and submit elements on a form should have the same name
>
> 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?
>
> Thanks,
> Ricky
>
>
> The information in this e-mail is intended only for the person to
> whom it is
> addressed. If you believe this e-mail was sent to you in error and
> the e-mail
> contains patient information, please contact the Partners Compliance
> HelpLine at
> http://www.partners.org/complianceline . If the e-mail was sent to
> you in error
> but does not contain patient information, please contact the sender
> and properly
> dispose of the e-mail.
>
More information about the development
mailing list