Item15129: FORMFIELD rev parameter broken

pencil
Priority: Normal
Current State: Closed
Released In: 2.1.8
Target Release: patch
Applies To: Engine
Component: FORMFIELD
Branches: Release02x01 master
Reported By: LynnwoodBrown
Waiting For:
Last Change By: MichaelDaum
The "rev" parameter for FORMFIELD macro has recently stopped working. If one includes this parameter, no value for form field is rendered. Perhaps this is related to work done Item15023?

Example:
  • Without rev parameter
    %FORMFIELD{"CurrentState" topic="Tasks.Item10988"}%
    Renders as: "Closed".
  • With rev parameter
    %FORMFIELD{"CurrentState" topic="Tasks.Item10988" rev="6"}%
    Renders as: "Waiting for Release".

-- LynnwoodBrown - 09 May 2022

Here's a patch that I am currently running unit tests with:

diff --git a/lib/Foswiki/Macros/FORMFIELD.pm b/lib/Foswiki/Macros/FORMFIELD.pm
index 2b55df8..7029a3f 100644
--- a/lib/Foswiki/Macros/FORMFIELD.pm
+++ b/lib/Foswiki/Macros/FORMFIELD.pm
@@ -62,7 +62,7 @@ sub FORMFIELD {
 
     if ( defined $rev && length($rev) ) {
         my $crev = $topicObject->getLoadedRev();
-        if ( defined $crev && $crev != $rev ) {
+        if ( !defined($crev) || $crev != $rev ) {
             $topicObject =
               Foswiki::Meta->load( $topicObject->session, $topicObject->web,
                 $topicObject->topic, $rev );

-- MichaelDaum - 10 May 2022
 
Topic revision: r3 - 06 Aug 2023, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy