• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item3524: Unwanted attributes in TWiki form of new registrations

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Normal Closed   patch  

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

This can be reproduced on TWiki.org which currently runs TWiki 4.1.0; system web is TWiki04x01.

TWiki:TWiki04x01/NewUserTemplate has this form:

%META:FORM{name="%25MAINWEB%25.UserForm"}%
%META:FIELD{name="FirstName" attributes="" title="First Name" value=""}%
%META:FIELD{name="LastName" attributes="" title="Last Name" value=""}%
%META:FIELD{name="OrganisationName" attributes="" title="Organisation Name" value=""}%
etc...

New registrations have this form attached:

%META:FORM{name="%25MAINWEB%25.UserForm"}%
%META:FIELD{name="FirstName" attributes="" definingTopic="" mandatory="" size="40" title="First Name" tooltip="" type="text" value="Luke"}%
%META:FIELD{name="LastName" attributes="" definingTopic="" mandatory="" size="40" title="Last Name" tooltip="" type="text" value="Metcalfe"}%
%META:FIELD{name="OrganisationName" attributes="" definingTopic="" mandatory="" size="40" title="Organisation Name" tooltip="" type="text" value=""}%
etc...

  • These attributes are unwanted: definingTopic="" mandatory="" size="40" tooltip="" type="text"

After first edit/save you get the expected, sample from TWiki:Main/LukeMetcalfe:

%META:FORM{name="%25MAINWEB%25.UserForm"}%
%META:FIELD{name="FirstName" attributes="" title="First Name" value="Luke"}%
%META:FIELD{name="LastName" attributes="" title="Last Name" value="Metcalfe"}%
%META:FIELD{name="OrganisationName" attributes="" title="Organisation Name" value=""}%
etc...

This is bad because one edit/save tells users that the complete form changed.

-- TWiki:Main/PeterThoeny - 29 Jan 2007

What is this definingTopic?

I can confirm the bug. I also have this in my registrations.

-- KennethLavrsen - 29 Jan 2007

Hmm, it looks like the Meta object is being used to park some fields that shouldn't be there.

Setting to Confirmed, since Ken has confirmed it.

CC

This is fixed now. Fix:

Index: MAIN/lib/TWiki/UI/Register.pm
===================================================================
--- MAIN/lib/TWiki/UI/Register.pm       (revision 12704)
+++ MAIN/lib/TWiki/UI/Register.pm       (working copy)
@@ -921,8 +921,9 @@
         foreach my $fd (@{$data->{form}}) {
             next unless $fd->{name} eq $field->{name};
             next if $SKIPKEYS{$fd->{name}};
-            $field->{value} = $fd->{value};
-            $meta->putKeyed( 'FIELD', $field );
+            my $item = $meta->get( 'FIELD', $fd->{name} );
+            $item->{value} = $fd->{value};
+            $meta->putKeyed( 'FIELD', $item );
             $inform{$fd->{name}} = 1;
             last;
         }

-- TWiki:Main.PeterThoeny - 03 Feb 2007

That doesn't work. The unit tests crash and burn. This works:

Index: TWiki/UI/Register.pm
===================================================================
--- TWiki/UI/Register.pm        (revision 12744)
+++ TWiki/UI/Register.pm        (working copy)
@@ -921,9 +921,14 @@
         foreach my $fd (@{$data->{form}}) {
             next unless $fd->{name} eq $field->{name};
             next if $SKIPKEYS{$fd->{name}};
-            my $item = $meta->get( 'FIELD', $fd->{name} );
-            $item->{value} = $fd->{value};
-            $meta->putKeyed( 'FIELD', $item );
+            $meta->putKeyed(
+                'FIELD',
+                {
+                    name => $fd->{name},
+                    attributes => '',
+                    title => $fd->{name},
+                    value => $fd->{value},
+                } );
             $inform{$fd->{name}} = 1;
             last;
         }

CC

This change broke registrations, see Item3562. I reverted it to my well tested fix.

Someone please update the unit tests to the proper spec, my test env is not stable enough.

-- TWiki:Main.PeterThoeny - 05 Feb 2007

The fix is in 4.1.1, but unit test update is pending. After unit test update is done, please set this to "closed".

-- TWiki:Main.PeterThoeny - 05 Feb 2007

Somebody updated the tests - at least, they stopped failing.

CC

ItemTemplate
Summary Unwanted attributes in TWiki form of new registrations
ReportedBy TWiki:Main.PeterThoeny
Codebase 4.1.0
SVN Range TWiki-4.1.0, Mon, 22 Jan 2007, build 12595
AppliesTo Engine
Component

Priority Normal
CurrentState Closed
WaitingFor

Checkins 12731 12757 12758 12766 12767
TargetRelease patch
ReleasedIn

Edit | Attach | Watch | Print version | History: r14 < r13 < r12 < r11 < r10 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r14 - 2007-04-22 - CrawfordCurrie
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback