You are here: Foswiki>Tasks Web>Item2097 (15 Mar 2011, GeorgeClark)Edit Attach

Item2097: FORMFIELD is not working as in TWiki due to chaneg in storing of form data

pencil
Priority: Low
Current State: Confirmed
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: DataForms, FORMFIELD
Branches:
Reported By: SimonKlempert
Waiting For:
Last Change By: GeorgeClark
Before updating to Foswiki (from old TWiki installation), form fields defined as
| *Name* | *Type* | *Size* | *Values* | *Tooltip message* | *Attributes* | 
| [[AllDbConnectCode][--DB_CONNECT_CODE]] | select | 1 | | Select the DB_CONNECT_CODE | |
were saved as
   %META:FIELD{name="DB_CONNECT_CODE" attributes="" title="--DB_CONNECT_CODE" value="xxx"}%

After they update they are saved as
   %META:FIELD{name="DB_CONNECT_CODE" attributes="" title="[[AllDbConnectCode][--DB_CONNECT_CODE]]" value="xxx"}%
(Please note the change in the title)

Therefore all our references, for example
   * Set V_DB_CONNECT_CODE = %FORMFIELD{"--DB_CONNECT_CODE" topic="%TOPIC%" format="$value"}%
stopped to work. Before --DB_CONNECT_CODE was found because name and title were searched and the search matched by the title. Now the title of the stored field changed and the formfiled search does not suceed anymore.

-- SimonKlempert

Some info is missing in your description...

-- ArthurClemens - 18 Sep 2009

Sorry, information was removed during save.

-- SimonKlempert - 21 Sep 2009

From IRC this fix is proposed (author classifies this as hack)

REF http://irclogs.foswiki.org/bin/irclogger_log/foswiki?date=2009-12-04,Fri&sel=217#l213

--- Render.pm.dist      2009-06-21 23:22:25.000000000 +0200
+++ Render.pm   2009-09-18 12:29:48.472320000 +0200
 -999,6 +999,16 @@
         foreach my $field (@fields) {
             my $name = $field->{name};
             $title = $field->{title} || $name;
+
+           # Spaced-out Wiki words with alternative link text
+           # i.e. [[$1][$3]]
+           # These might be contained now in the title of form fields
+           my ($double_bracket_link, undef, $double_bracket_title) =
+             $title =~ /\[\[([^\]\[\n]+)\](\[([^\]\n]+)\])?\]/;
+            if (defined $double_bracket_title && $double_bracket_title) {
+               $title = $double_bracket_title;
+           }
+
             if ( $title eq $formField || $name eq $formField ) {
                 $found = 1;
                 $text =~ s/\$title/$title/go;

I include it now because IRC is a thing that gets lost quickly

-- KennethLavrsen - 04 Dec 2009

INHO this is a case where trying to achieve compatibility would be a mistake. VarFORMFIELD clearly documents that it uses the name of the formfield - not the title, the name. I appreciate the distinction is thin in many people's eyes, but it's there, and I regard the looking up of the title as a bug. The title is a visual representation only, and should never be used in looking up the value of a field.

I don't propose to fix FORMFIELD, as it is deprecated in favour of QUERY. But I'll leave it open, at Low priority, in case someone is motivated to fix it properly.

-- CrawfordCurrie - 25 Jun 2010

ItemTemplate edit

Summary FORMFIELD is not working as in TWiki due to chaneg in storing of form data
ReportedBy SimonKlempert
Codebase 1.0.6
SVN Range Foswiki-1.0.6, Sun, 21 Jun 2009, build 4272
AppliesTo Engine
Component DataForms, FORMFIELD
Priority Low
CurrentState Confirmed
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
Topic revision: r6 - 15 Mar 2011, GeorgeClark
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