<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hey,<div class=""><br class=""></div><div class="">use the manual Luke!:)</div><div class=""><br class=""></div><div class=""><a href="http://www.template-toolkit.org/docs/manual/Directives.html" class="">http://www.template-toolkit.org/docs/manual/Directives.html</a></div><div class=""><br class=""></div><div class="">Search for sort.</div><div class=""><br class=""></div><div class=""><% FOREACH ID IN Jobs.keys.sort %></div><div class=""><% FOREACH ID IN Jobs.keys.nsort %></div><div class=""><br class=""></div><div class=""><span style="color: rgb(84, 84, 84); font-family: arial, sans-serif; font-size: small; line-height: 18.2000007629395px; widows: 1; background-color: rgb(255, 255, 255);" class="">sorted alphabetically ( </span><span style="font-weight: bold; color: rgb(106, 106, 106); font-family: arial, sans-serif; font-size: small; line-height: 18.2000007629395px; widows: 1; background-color: rgb(255, 255, 255);" class="">sort</span><span style="color: rgb(84, 84, 84); font-family: arial, sans-serif; font-size: small; line-height: 18.2000007629395px; widows: 1; background-color: rgb(255, 255, 255);" class=""> ) or numerically ( </span><span style="font-weight: bold; color: rgb(106, 106, 106); font-family: arial, sans-serif; font-size: small; line-height: 18.2000007629395px; widows: 1; background-color: rgb(255, 255, 255);" class="">nsort</span><span style="color: rgb(84, 84, 84); font-family: arial, sans-serif; font-size: small; line-height: 18.2000007629395px; widows: 1; background-color: rgb(255, 255, 255);" class=""> )</span></div><div class=""><span style="color: rgb(84, 84, 84); font-family: arial, sans-serif; font-size: small; line-height: 18.2000007629395px; widows: 1; background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div class=""><span style="color: rgb(84, 84, 84); font-family: arial, sans-serif; font-size: small; line-height: 18.2000007629395px; widows: 1; background-color: rgb(255, 255, 255);" class="">Best regards,</span></div><div class=""><span style="color: rgb(84, 84, 84); font-family: arial, sans-serif; font-size: small; line-height: 18.2000007629395px; widows: 1; background-color: rgb(255, 255, 255);" class="">Attila</span></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 26 Aug 2015, at 15:51, Richard Reina <<a href="mailto:gatorreina@gmail.com" class="">gatorreina@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I have this table data that I load into a template as follows.<br class=""><div class=""><br class=""> $q = "SELECT ID, NAME<br class=""> FROM jobs <br class=""> ORDER BY NAME";<br class=""> $sth = $dbh->prepare($q);<br class=""> $sth->execute();<br class=""> my $Jobs_ref = $sth->fetchall_hashref('ID'); <br class=""> <br class=""> template '<a href="http://sport_add.tt/" class="">sport_add.tt</a>', { <br class=""> <br class=""> 'Jobs' => $Jobs_ref,<br class=""> 'Testing' => "This is text to test to make sure this will come through", <br class=""> # to test, use this like <% Testing %> on your template page<br class=""><br class="">}, {};<br class=""><br class=""></div><div class="">To display it in the template as a drop-down select I do:<br class=""><br class=""> <select class="selectpicker" name="jobselect" id="jobselect" style="width: 500px;"><br class=""> <% FOREACH ID IN Jobs.keys %><br class=""> <option value="<% Jobs.$<a href="http://id.id/" class="">ID.ID</a> %>"><% Jobs.$<a href="http://id.name/" class="">ID.NAME</a> %></option><br class=""> <% END %><br class=""><br class=""></div><div class="">And it works great. Except for one thing, the list is not in order by name. I have read more than a few posts about how once you save a query as a hashref that the order is lost. Most of those posts suggested fetching as a arrayref instead. However, I have no idea how to do that and then display it in a select like the above code does. So I wanted to see if somebody perhaps knows of a not too complicated of a solution to get the select list into alphabetical order by name.<br class=""><br class=""></div><div class="">Thanks<br class=""></div></div>
_______________________________________________<br class="">dancer-users mailing list<br class=""><a href="mailto:dancer-users@dancer.pm" class="">dancer-users@dancer.pm</a><br class="">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users<br class=""></div></blockquote></div><br class=""></div></body></html>