[Bps-public-commit] r12899 - in RT-FormTools: .
falcone at bestpractical.com
falcone at bestpractical.com
Wed Jun 4 17:49:26 EDT 2008
Author: falcone
Date: Wed Jun 4 17:49:24 2008
New Revision: 12899
Modified:
RT-FormTools/ (props changed)
RT-FormTools/html/FormTools/Field
Log:
r33792 at ketch: falcone | 2008-06-04 17:48:45 -0400
* allows you to reload a form if there were errors and
we'll look in the request args and try to fill
fields back in
Modified: RT-FormTools/html/FormTools/Field
==============================================================================
--- RT-FormTools/html/FormTools/Field (original)
+++ RT-FormTools/html/FormTools/Field Wed Jun 4 17:49:24 2008
@@ -30,6 +30,17 @@
$field_label ||= $cf->Name;
}
+unless ( $default ) {
+ my $request_args = $m->request_args();
+ if ( $field_type eq 'core' && $request_args->{$name} ) {
+ $default = $request_args->{$name};
+ } elsif ( $cf->Id ) {
+ $default = ($request_args->{$NamePrefix.$cf->Id."-Value"} ||
+ $request_args->{$NamePrefix.$cf->Id."-Values"} );
+ }
+ $RT::Logger->error("default $default for name $name") if $default;
+}
+
</%init>
<table style="display: inline; "><tr><th valign="top"><label><%$field_label%></label></th><td style="display:block;">
% if ($field_type eq 'core') {
@@ -41,7 +52,7 @@
<& /Elements/EditCustomField, Object => $queue, CustomField => $cf, NamePrefix => $NamePrefix,
($cf->Type =~ /text/i) ? (Rows => 6, Cols => $cols ||60) : (),
($cf->Type =~ /freeform/i) ? (Rows => 6, Cols => $cols ||30) : (),
-
+ ($default ? (Default => $default) : ())
&>
% } elsif ($render_as =~ /^radio/) {
@@ -58,7 +69,11 @@
% while ($CFVs and my $value = $CFVs->Next ) {
<input type="radio" name="<%$id%>-Values" value="<%$value->Name%>"
% if ($default) {
+% if (ref $default) {
+ <% (grep { $_ eq $value->Name} @$default) ? 'CHECKED' : '' %>
+% } else {
<% ($default eq $value->Name) ? 'CHECKED' : '' %>
+% }
% }
><% $value->Name%>
@@ -73,7 +88,11 @@
% while ($CFVs and my $value = $CFVs->Next ) {
<input type="checkbox" name="<%$id%>-Values" value="<%$value->Name%>"
% if ($default) {
+% if (ref $default) {
+ <% (grep { $_ eq $value->Name} @$default) ? 'CHECKED' : '' %>
+% } else {
<% ($default eq $value->Name) ? 'CHECKED' : '' %>
+% }
% }
><% $value->Name%>
% if ($render_as =~ /vertical/) {
More information about the Bps-public-commit
mailing list