chiark / gitweb /
routesearch: fix up web performance parameterisation
[ypp-sc-tools.db-test.git] / yarrg / web / qtextstring
index d57f863490fda37637957afd0e988be1e1c4f14d..93eb1249633499550bf763cb7c33ccd1c735115b 100644 (file)
@@ -40,7 +40,7 @@ $qa => $m->caller_args(1)->{'qa'}
 $dbh
 $thingstring
 $emsgstore
-$perresult
+$onresults
 $prefix => 'ts';
 $helpref => undef;
 </%args>
@@ -49,6 +49,9 @@ my $stringval= $qa->{$thingstring};
 $stringval='' if !defined $stringval;
 
 my $p= $prefix.'_';
+my $checker= $m->fetch_comp("check_${thingstring}");
+my $significant_nonempty= $checker->attr_exists('significant_nonempty');
+
 </%perl>
 
 <&| script &>
@@ -58,7 +61,7 @@ my $p= $prefix.'_';
 
 <%$p%>timeout=false;
 <%$p%>request=false;
-<%$p%>done='';
+<%$p%>done=<% $significant_nonempty ? "null" : "''" %>;
 <%$p%>needed='';
 function <%$p%>Later(){
   window.clearTimeout(<%$p%>timeout);
@@ -103,8 +106,8 @@ register_onload(<%$p%>Needed);
 <div id="<%$p%>results">&nbsp;</div><br>
 
 <%perl>
-if (length $thingstring) {
-       my ($emsg,$canonstring,$results)= $m->comp('qtextstringcheck',
+if ($significant_nonempty || length $thingstring) {
+       my ($emsg,$canonstring,@results)= $m->comp('qtextstringcheck',
                what => $thingstring,
                ocean => $qa->{Ocean},
                string => $stringval,
@@ -114,10 +117,6 @@ if (length $thingstring) {
                $$emsgstore='' unless defined $$emsgstore;
                $$emsgstore .= $emsg. ' ';
        }
-
-       foreach my $entry (@$results) {
-#print STDERR "qts entry perresult \`@$entry'\n";
-               $perresult->(@$entry);
-       }
+       $onresults->(@results);
 }
 </%perl>