[dancer-users] Getting param name of dynamically named <input> tag

Richard Reina gatorreina at gmail.com
Wed Oct 21 15:10:52 BST 2015


2015-10-10 3:36 GMT-05:00 Dave Cross <dave at dave.org.uk>:

> On 09/10/15 22:32, Richard Reina wrote:
>
>>
>> 2015-10-09 16:12 GMT-05:00 Christian Huldt <christian at solvare.se
>> <mailto:christian at solvare.se>>:
>>
>>     To me, that seems to be able to add several tags with the same id - I
>>     think that is harmful...
>>
>> I don't think it adds the tags with the same name
>>
>
> Hi didn't say "name", he said "id". Names and IDs are different things in
> HTML. IDs have far stricter rules than names.
>
>
> Dave...
>
> --
> Dave Cross :: dave at dave.org.uk
> http://dave.org.uk/
> @davorg
>

Hello all,

Sorry for the tardy reply. Dave, thank you for your insightful advice. It
was your observation that p_scnt jumps to 2 that helped me to capture the
email addresses with the following code:

my $i = 2;
    my @recipients = param('p_scnt');
    my $recipient;
    my $sbj = param('sbj');
    my $msg = param('edited_msg');

    while (param("p_scnt_$i")) {

        push(@recipients, param("p_scnt_$i"));
        $i++;

    }

I did not modified the JS code so that it generates multiple IDs -- I
simply left it as is. This works for my needs because these email address
are merely being captured, validated and then used to send an email
announcement by the user -- they are not being saved or otherwise processed
in any other way. As long as it works is it okay not to fix it?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20151021/80b8be69/attachment.html>


More information about the dancer-users mailing list