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