chiark / gitweb /
Allow downloading of database tree source code via dictup CGI scripts
[ypp-sc-tools.db-live.git] / yarrg / web / qtextstring
index c958915ae33fdfa012c0e9ab639db0636d84b95e..e046c56c3d4f90c7fe4b3034836015ca64e73879 100644 (file)
@@ -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);
@@ -94,6 +97,7 @@ function <%$p%>Ready() {
 register_onload(<%$p%>Needed);
 </&script>
 
+% if (!printable($m)) {
 <input type="text" <% $m->content %>
  id="<% $thingstring %>" name="<% $thingstring %>"
  onchange="<%$p%>Needed();" onkeyup="<%$p%>Later();"
@@ -101,9 +105,14 @@ register_onload(<%$p%>Needed);
  ><% defined($helpref) ? "<a href=\"docs#$helpref\">[?]</a>" : '' %>
 <br>
 <div id="<%$p%>results">&nbsp;</div><br>
+% } else {
+<kbd><strong><% $stringval |h %></strong></kbd>
+<br>
+<br>
+% }
 
 <%perl>
-if (length $thingstring) {
+if ($significant_nonempty || length $thingstring) {
        my ($emsg,$canonstring,@results)= $m->comp('qtextstringcheck',
                what => $thingstring,
                ocean => $qa->{Ocean},