Re: [Mojolicious] Get an array from checkboxes
thanks a lot ! It was a problem with some checkboxes. All is ok ! Selon Felipe Gasper : > https://developer.mozilla.org/en-US/docs/Web/API/FormData > > ^^ Also, if you’re not sure whether the problem is in Perl or in the browser, > you can use this to see what data the browser intends to send prior to > sending. > > -FG > > > > On Mar 2, 2020, at 10:51 AM, Dan Book wrote: > > > > That is correct, it should return all "values" of checked items with that > > "name". I don't know what the distinction of "new checked values" is that > > you mention. Make sure the checkboxes are all within the same form tag. > > > > -Dan > > > > On Mon, Mar 2, 2020 at 10:38 AM mab974 wrote: > > Thanks Dan ! > > > > It seems I get only the NEW checked values not all checked values. > > Do I use it the right way ? > > > > my @members = @{$c->every_param('groupMembers')}; > > > > > > > > Selon Dan Book : > > > param returns a single value, by design, because this avoids the context > > > sensitivity bug that led to for example > > > https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-1572. To get > > > multiple values, use every_param, which returns an array reference: > > > > > > my $groups = $c->every_param('groupMemberships'); > > > > > > -Dan > > > > > > On Sun, Mar 1, 2020 at 3:46 PM mab974 wrote: > > > > > > > Hi, > > > > > > > > How do I get multiple checkbox values as an array? > > > > I always get the value of the last checked checkbox. > > > > > > > > > > > > my example : > > > > in template > > > > > > > > %= check_box 'groupMemberships' => $groupname > > > > > > > > or when checked > > > > > > > > > > > > > > > > and in controller > > > > > > > > my @groups = $c->param('groupMemberships'); > > > > > > > > Thanks in advance. > > > > > > > > Regards, > > > > -*- mab974 -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/mojolicious/20200302201351.683ad71dda92fda54e7cc91c%40gmail.com.
Re: [Mojolicious] Get an array from checkboxes
https://developer.mozilla.org/en-US/docs/Web/API/FormData ^^ Also, if you’re not sure whether the problem is in Perl or in the browser, you can use this to see what data the browser intends to send prior to sending. -FG > On Mar 2, 2020, at 10:51 AM, Dan Book wrote: > > That is correct, it should return all "values" of checked items with that > "name". I don't know what the distinction of "new checked values" is that you > mention. Make sure the checkboxes are all within the same form tag. > > -Dan > > On Mon, Mar 2, 2020 at 10:38 AM mab974 wrote: > Thanks Dan ! > > It seems I get only the NEW checked values not all checked values. > Do I use it the right way ? > > my @members = @{$c->every_param('groupMembers')}; > > > > Selon Dan Book : > > param returns a single value, by design, because this avoids the context > > sensitivity bug that led to for example > > https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-1572. To get > > multiple values, use every_param, which returns an array reference: > > > > my $groups = $c->every_param('groupMemberships'); > > > > -Dan > > > > On Sun, Mar 1, 2020 at 3:46 PM mab974 wrote: > > > > > Hi, > > > > > > How do I get multiple checkbox values as an array? > > > I always get the value of the last checked checkbox. > > > > > > > > > my example : > > > in template > > > > > > %= check_box 'groupMemberships' => $groupname > > > > > > or when checked > > > > > > > > > > > > and in controller > > > > > > my @groups = $c->param('groupMemberships'); > > > > > > Thanks in advance. > > > > > > Regards, > > > > > > -*- > > > mab974 > > > > > > -- > > -*- > mab974 > > -- > You received this message because you are subscribed to the Google Groups > "Mojolicious" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to mojolicious+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/mojolicious/20200302193802.4f94f42c5414f87a1cf133d8%40gmail.com. > > -- > You received this message because you are subscribed to the Google Groups > "Mojolicious" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to mojolicious+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/mojolicious/CABMkAVWFJ1PAZ%3D7CY9J9MktTB-rNCo8A36p3K2uGppPhHTF7-w%40mail.gmail.com. -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/mojolicious/3CC64B1E-9F5B-4CE4-9C77-8931AA239081%40felipegasper.com.
Re: [Mojolicious] Get an array from checkboxes
That is correct, it should return all "values" of checked items with that "name". I don't know what the distinction of "new checked values" is that you mention. Make sure the checkboxes are all within the same form tag. -Dan On Mon, Mar 2, 2020 at 10:38 AM mab974 wrote: > Thanks Dan ! > > It seems I get only the NEW checked values not all checked values. > Do I use it the right way ? > > my @members = @{$c->every_param('groupMembers')}; > > > > Selon Dan Book : > > param returns a single value, by design, because this avoids the context > > sensitivity bug that led to for example > > https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-1572. To get > > multiple values, use every_param, which returns an array reference: > > > > my $groups = $c->every_param('groupMemberships'); > > > > -Dan > > > > On Sun, Mar 1, 2020 at 3:46 PM mab974 wrote: > > > > > Hi, > > > > > > How do I get multiple checkbox values as an array? > > > I always get the value of the last checked checkbox. > > > > > > > > > my example : > > > in template > > > > > > %= check_box 'groupMemberships' => $groupname > > > > > > or when checked > > > > > > > > > > > > and in controller > > > > > > my @groups = $c->param('groupMemberships'); > > > > > > Thanks in advance. > > > > > > Regards, > > > > > > -*- > > > mab974 > > > > > > -- > > -*- > mab974 > > -- > You received this message because you are subscribed to the Google Groups > "Mojolicious" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to mojolicious+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/mojolicious/20200302193802.4f94f42c5414f87a1cf133d8%40gmail.com > . > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/mojolicious/CABMkAVWFJ1PAZ%3D7CY9J9MktTB-rNCo8A36p3K2uGppPhHTF7-w%40mail.gmail.com.
Re: [Mojolicious] Get an array from checkboxes
Thanks Dan ! It seems I get only the NEW checked values not all checked values. Do I use it the right way ? my @members = @{$c->every_param('groupMembers')}; Selon Dan Book : > param returns a single value, by design, because this avoids the context > sensitivity bug that led to for example > https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-1572. To get > multiple values, use every_param, which returns an array reference: > > my $groups = $c->every_param('groupMemberships'); > > -Dan > > On Sun, Mar 1, 2020 at 3:46 PM mab974 wrote: > > > Hi, > > > > How do I get multiple checkbox values as an array? > > I always get the value of the last checked checkbox. > > > > > > my example : > > in template > > > > %= check_box 'groupMemberships' => $groupname > > > > or when checked > > > > > > > > and in controller > > > > my @groups = $c->param('groupMemberships'); > > > > Thanks in advance. > > > > Regards, > > > > -*- > > mab974 > > > > -- -*- mab974 -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/mojolicious/20200302193802.4f94f42c5414f87a1cf133d8%40gmail.com.