[Bps-public-commit] rt-extension-formtools branch, set-default-value-to-submitted-args-first, created. 0.50-8-g38ee6bd

Craig Kaiser craig at bestpractical.com
Fri Apr 17 13:38:51 EDT 2020


The branch, set-default-value-to-submitted-args-first has been created
        at  38ee6bd5f169c88b84f0c9aa220db2e27249389a (commit)

- Log -----------------------------------------------------------------
commit 38ee6bd5f169c88b84f0c9aa220db2e27249389a
Author: Craig Kaiser <craig at bestpractical.com>
Date:   Fri Apr 17 13:36:50 2020 -0400

    Have the submitted args values have the highest priority for default value
    
    This allows for pages that redirect to themselves on error to populate
    inputs with the submittted values from the previous page.

diff --git a/html/FormTools/Field b/html/FormTools/Field
index 06608b7..258a45f 100644
--- a/html/FormTools/Field
+++ b/html/FormTools/Field
@@ -78,14 +78,12 @@ if ( RT::Extension::FormTools::is_core_field($name) ) {
 }
 
 
-unless ( $default ) {
-    my $request_args = $m->request_args();
-    if ( $field_type eq 'core' && $request_args->{$name} ) {
-        $default = $request_args->{$name};
-    } elsif ( $field_type eq 'custom' &&  $cf->Id ) {
-        $default = ($request_args->{ $input_name } || 
-                    $request_args->{ $input_name .'s' } );
-    }
+my $request_args = $m->request_args();
+if ( $field_type eq 'core' && $request_args->{$name} ) {
+    $default = $request_args->{$name};
+} elsif ( $field_type eq 'custom' &&  $cf->Id ) {
+    $default = ($request_args->{ $input_name } ||
+                $request_args->{ $input_name .'s' } );
 }
 
 $default = '' unless defined $default;

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list