rt 4.2.16
[freeside.git] / rt / share / html / Search / Elements / ConditionRow
index fe21f4d..43bb3c7 100644 (file)
@@ -2,7 +2,7 @@
 %#
 %# COPYRIGHT:
 %#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2019 Best Practical Solutions, LLC
 %#                                          <sales@bestpractical.com>
 %#
 %# (Except where explicitly superseded by other copyright notices)
@@ -74,15 +74,18 @@ $handle_block = sub {
         return $m->scomp( $box->{'Path'}, %{ $box->{'Arguments'} }, Name => $name );
     }
     if ( $box->{'Type'} eq 'text' ) {
-        my $default = $box->{'Default'} || '';
-        my $size = $box->{'Size'}? qq{size="$box->{'Size'}"} : '';
-        return qq{<input id="$name" name="$name" value="$default" $size />};
+        $box->{id} ||= $box->{name} ||= $name;
+        $box->{value} ||= delete($box->{Default}) || '';
+        return "<input ".join(" ", map{$m->interp->apply_escapes(lc($_),'h')
+                                      .q{="}.$m->interp->apply_escapes($box->{$_},'h').q{"}}
+                                   sort keys %$box)." />";
     }
     if ( $box->{'Type'} eq 'select' ) {
         my $res = '';
         $res .= qq{<select id="$name" name="$name">};
         my @options = @{ $box->{'Options'} };
-        while( my $k = shift @options ) {
+        while( @options ) {
+            my $k = shift @options;
             my $v = shift @options;
             $res .= qq{<option value="$k">$v</option>};
         }