X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Fweb%2Fqtextstring;h=6872e7ecdd449c353a6828dd5807462d62f7808f;hb=aecbbcbe68e6f59fe9319f307ac49f4e616cc351;hp=c958915ae33fdfa012c0e9ab639db0636d84b95e;hpb=422fab9f34f08090bca02f67cb41bba31f816c7e;p=ypp-sc-tools.db-test.git diff --git a/yarrg/web/qtextstring b/yarrg/web/qtextstring index c958915..6872e7e 100644 --- a/yarrg/web/qtextstring +++ b/yarrg/web/qtextstring @@ -39,26 +39,32 @@ $qa => $m->caller_args(1)->{'qa'} $dbh $thingstring +$checkkind => undef $emsgstore $onresults -$prefix => 'ts'; -$helpref => undef; +$boxopts => 'size=10' +$prefix => 'ts' +$helpref => undef <%perl> my $stringval= $qa->{$thingstring}; $stringval='' if !defined $stringval; +$checkkind= $thingstring if !defined $checkkind; my $p= $prefix.'_'; +my $checker= $m->fetch_comp("check_${checkkind}"); +my $significant_nonempty= $checker->attr_exists('significant_nonempty'); + <&| script &> <%$p%>uri= "qtextstringcheck?format=application/json&ctype=text/xml" - + "&what=<% $thingstring %>" + + "&what=<% $checkkind %>" + "&ocean=<% uri_escape($qa->{Ocean}) %>"; <%$p%>timeout=false; <%$p%>request=false; -<%$p%>done=''; +<%$p%>done=<% $significant_nonempty ? "null" : "''" %>; <%$p%>needed=''; function <%$p%>Later(){ window.clearTimeout(<%$p%>timeout); @@ -94,18 +100,13 @@ function <%$p%>Ready() { register_onload(<%$p%>Needed); -content %> - id="<% $thingstring %>" name="<% $thingstring %>" - onchange="<%$p%>Needed();" onkeyup="<%$p%>Later();" - value="<% $stringval |h %>" - ><% defined($helpref) ? "[?]" : '' %> -
-
 

- <%perl> -if (length $thingstring) { - my ($emsg,$canonstring,@results)= $m->comp('qtextstringcheck', - what => $thingstring, +my ($canonstring); + +if ($significant_nonempty || length $thingstring) { + my ($emsg,@results); + ($emsg,$canonstring,@results)= $m->comp('qtextstringcheck', + what => $checkkind, ocean => $qa->{Ocean}, string => $stringval, format => 'return' @@ -117,3 +118,18 @@ if (length $thingstring) { $onresults->(@results); } + +% if (!printable($m)) { + + id="<% $thingstring %>" name="<% $thingstring %>" + onchange="<%$p%>Needed();" onkeyup="<%$p%>Later();" + value="<% $stringval |h %>" + ><% defined($helpref) ? "[?]" : '' %><% + $m->content %> +
+
 

+% } else { +<% $canonstring |h %> +
+
+% }