cross
New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists
You are here: Foswiki>Tasks Web>Item13355 (05 Jul 2015, GeorgeClark)Edit Attach

Item13355: Formfield titles not expanding macros

pencil
Priority: Urgent
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Engine
Component: DataForms
Branches: master
Reported By: PadraigLennon
Waiting For:
Last Change By: GeorgeClark
In the form System.UserForm there is a field called Country defined as follows:

| [[%SYSTEMWEB%.CountryList][Country]] | select | 1 | | | |

The %SYSTEMWEB% macro does not get expanded and the field does not show the values in edit mode

When the web is hardcoded as follows it works:

| [[System.CountryList][Country]] | select | 1 | | | |

-- PadraigLennon - 07 Apr 2015

Here is a fix. Needs someone with greater form expertise then me to validate:

diff --git a/core/lib/Foswiki/Form.pm b/core/lib/Foswiki/Form.pm
index beb8247..7d94dc1 100644
--- a/core/lib/Foswiki/Form.pm
+++ b/core/lib/Foswiki/Form.pm
@@ -345,7 +345,7 @@ sub _parseFormDefinition {
             if ( $field{title} =~ m/\[\[(.+)\]\[(.+)\]\]/ ) {
 
                 # use common defining topics with different field titles
-                $field{definingTopic} = fieldTitle2FieldName($1);
+                $field{definingTopic} = fieldTitle2FieldName(Foswiki::Func::expandCommonVariables($1));
                 $field{title}         = $2;
             }
 

MichaelDaum, this probably needs your review. Seems simple enough. Allows use of %SYSTEMWEB% in the form definition. But forms are tricky and I'm hesitant to just check it in.

-- GeorgeClark - 07 Apr 2015

I went ahead and checked the fix in. It resolved the issue padraig_lennon reported on IRC.

-- GeorgeClark - 08 Apr 2015

Good catch.

-- MichaelDaum - 08 Apr 2015
 

ItemTemplate edit

Summary Formfield titles not expanding macros
ReportedBy PadraigLennon
Codebase 1.2.0 beta1
SVN Range
AppliesTo Engine
Component DataForms
Priority Urgent
CurrentState Closed
WaitingFor
Checkins distro:4ae8ec5fb491
TargetRelease major
ReleasedIn 2.0.0
CheckinsOnBranches master
trunkCheckins
masterCheckins distro:4ae8ec5fb491
ItemBranchCheckins
Release01x01Checkins
Topic revision: r6 - 05 Jul 2015, GeorgeClark - This page was cached on 21 Mar 2018 - 20:20.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License