<div dir="ltr"><div>I have to following template that lists table data with a checkbox to the left and a text area to the right -- special thanks to Andrew for helping me figure out the HTML. <br><br></div><div>The data comes from:<br><br> my $q = "SELECT c.ID AS ID, u.screenname AS SNAME, <a href="http://a.name">a.name</a> AS ANAME, a.descrip AS DESCRIP, <br> c.season AS SSN, c.year AS YR, <a href="http://ch.name">ch.name</a> AS CHNAME <br> FROM challenge c, accomp_type a, usuario u, jugador j, charity ch <br> WHERE c.ACC_TYPE_ID=a.ID <br> AND ch.ID=c.CHAR_ID <br> AND c.PLR_ID=j.ID <br> AND j.USER_ID=u.ID";<br></div><div>my $Chlngs = $dbh->selectall_hashref( $q, 'ID' );<br><br><div class="container" style="margin-top:20px;"><br> <div class="row"><br> <div class="col-xs-12"><br> <form role="form" action="openchallenges" method="POST"><br> <h3 class="text-center">Open To Do</h3><br> <div class="well" style="max-height: 300px;overflow: auto;"><br> <ul class="list-group fancy-list-items"> <!-- <ul class="list-group checked-list-box"> --> <br> <table style="width:100%"> <br> <% FOREACH ID IN Chlngs.keys.sort %><br> <tr class="list-group-item"><br> <td width="5"> <input type="checkbox" name="<% Chlngs.$<a href="http://ID.NAME">ID.NAME</a> %>"</input> </td><br> <td width="70"><% Chlngs.$ID.SNAME %></td> <br> <td width="75"><% Chlngs.$ID.ANAME %></td><br> <td width="35"><% Chlngs.$ID.SSN %></td> <br> <td width="35"><% Chlngs.$ID.YR %></td><br> <td width="250"><% Chlngs.$ID.CHNAME %></td><br> <td width="550"><% Chlngs.$ID.DESCRIP %></td><br> <td><input type="text" name="<% Chlngs.$<a href="http://ID.ID">ID.ID</a> %>" size="8" </td><br> <% END %><br> </tr><br> </ul><br> </table> <br> </div><br> <hr class="colorgraph"><br> <div class="row"><br> <div class="col-xs-12 col-md-12"><input type="submit" value="Submit" class="btn btn-primary btn-block btn-lg"></div><br> </form><br> </div><br> </div><br></div><br><br>However, after getting the template to work I am once again stumped in
how to capture the value of the dynamically named hash ref -- specifically the second one from the text box. I have tried various permutations below -- some of which were very graciously provided to me in an earlier similar thread -- but all seem to only give me either a hash reference, the value of ID or this error when I place the number 7 into the text field: Can't use string ("7") as a HASH ref while "strict refs" in use at /home/richard/Dancer2/MyApp/bin/../lib/MyApp.pm line 463.
</div><div><br> <br>my $input_hash; <br><br> foreach my $key ( keys %$Chlngs ) {<br> print "Checking Chlgs: " . $key . " for value.\n";<br> if ( param( $key ) ) { # paramter has value<br> #$input_hash->{ $key } = $Chlngs->{ $key };<br> $input_hash->{ $key } = param( $key );<br> #print $key, $input_hash->{ $key }, "\n";<br> #print %{ $input_hash->{1} };<br> print $input_hash->{1}{ID}, "\n"; <br> # $sth->execute($PLR_ID, $key, $input_hash->{Season}, $input_hash->{Year}, $input_hash->{CharID}); <br><br> }<br> }<br><br></div><div>Thanks for any help.<br><br></div><div>Richard<br></div></div>