chiark / gitweb /
Pass $dbh down through the stack, for better lifetime
[ypp-sc-tools.web-live.git] / yarrg / web / query_commod
index 5a7497bac9d3d8d042bf40c031d565bf952607d2..9cb14ca6870e70abf887b518f2e9698313d67158 100644 (file)
 </%doc>
 <%args>
 $quri
+$dbh
 $commodstring => '';
+$someresults
+$emsgokorprint
 </%args>
 
-% my $qa= \%ARGS;
+<%perl>
+my $emsg;
+my ($commodname,$commodid);
+
+my $qa= \%ARGS;
+</%perl>
+
+<h1>Select commodity</h1>
 
 %#---------- textbox, user enters route as string ----------
 % if (!$qa->{Dropdowns}) {
 
-<h1>Select commodity</h1>
+Enter commodity (abbreviations are OK):<br>
 
 <form action="<% $quri->() |h %>" method="get">
 
-<&| qtextstring, qa => $qa, thingstring => 'commodstring' &>
+<&| qtextstring, qa => $qa, dbh => $dbh,
+    thingstring => 'commodstring', emsgstore => \$emsg,
+    perresult => sub { ($commodname,$commodid)= @_; }
+ &>
  size=80
 </&>
 
 % } else { #---------- dropdowns, user selects from menus ----------
 
+Not yet implemented.
+
 % } #---------- end of dropdowns, now common middle of page code ----------
+
+<input type=submit name=submit value="Go">
+% my $ours= sub { $_[0] =~ m/^commodstring|^commodid/; };
+<& "lookup:formhidden", ours => $ours &>
+
+</form>
+
+%#========== results ==========
+% $emsgokorprint->($emsg) or $commodid=undef;
+
+% if (defined $commodid) {
+%      $someresults->();
+COMMODITY <% $commodid %> named <% $commodname |h %>
+
+% }