[dancer-users] Trapping parameters from a dynamic list of checkboxes.

Richard Reina gatorreina at gmail.com
Thu Aug 27 16:42:46 BST 2015


Hi WK,

Thanks for the reply. Line 577 is the print statement  print $key
$input_hash->{ $key } . "\n"; In the foreach. I know I shouldn't be
printing here however, I just want to see what value comes across for for
example $input_hash->{ '13' } before I create a DB record based on that
value.So I guess I just need help figuring out how to see or get the value
out of $input_hash->{ID NUMBER}.



2015-08-27 10:07 GMT-05:00 WK <wanradt at gmail.com>:

> 2015-08-27 17:28 GMT+03:00 Richard Reina <gatorreina at gmail.com>:
>
> > After figuring out how to accommodate my placeholder in
> selectall_hashref I
> > did this:
> >
> >  my $Accomps = $dbh->selectall_hashref( $q, 'ID', \%attr, $Sid );
>
> If you need placeholder here, but you don't have need for any
> attributes, you may use `undef` here
>
> my $Accomps = $dbh->selectall_hashref( $q, 'ID', undef, $Sid );
>
> > Then as you suggested I do:
> >
> >  # get parameter for accomp type keys
> >       foreach my $key ( keys %$Accomps ) {
> >       print "Checking: " . $key . " for value.\n";
> >       if ( param( $key ) ) {
> >           $input_hash->{ $key } = $Accomps->{ $key };
> >           print $key $input_hash->{ $key } . "\n";
> >       }
> >       }
> >
> > (just printing temporarily to see if it trapped the values)
>
> Here we actually don't need values of $Accomps-hashref, we just using
> it as list to check out form values, so depending of your futher
> needs, you may assign your specific value here, like, for example:
>
>            $input_hash->{ $key } = 1;
>
> > However, I get this error:
> >
> >  Route exception: Can't use string ("1") as a symbol ref while "strict
> refs"
> > in use at /home/richard/Dancer2/MyApp/bin/../lib/MyApp.pm line 557.
> >
> > Any idea what I am doing wrong?
>
> What is on line 577 of your MyApp.pm?
>
> Wbr,
> --
> Kõike hääd,
>
> Gunnar
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20150827/b231ac46/attachment.html>


More information about the dancer-users mailing list