I have a TWiki application with label form fields in the TWiki Form. If a label contains a WikiWord,
garbage is shown for the label field in edit mode, content gets destroyed after save.
Form content before edit/save cycle: (Cairo format)
META:FIELD{name="Classification" title="Classification" value="DocDB"}
META:FIELD{name="File" title="File" value="WikisInEnterprise.pdf"}
Both are of label type.
Form content after edit/save cycle: (Dakar format)
META:FIELD{name="Classification" attributes="" title="Classification" value="<a href="}
META:FIELD{name="File" attributes="" title="File" value="<span class="}
This bug prevents me from updating a site to Dakar since it destroys data.
--
PTh
I tried to reproduce it at
TestTemplate but could not. Apparently it happens with a 1.0 format topic that gets converted to 1.1 format.
--
PTh
Please attach a topic with the 1.0 format that get's garbled (check previous revision of the topic you're using) so we can properly test.
--
RA
See attached
tt.zip file. Also copied on this server to
Sandbox.DocForm,
Sandbox.DocID1,
Sandbox.DocID2.
--
PTh
Locally, I have the full generated XHTML put in the field generated after save (not only the part until first "). (BTW, danish
I18N in this paste, s/Opret/Create/).
%META:FIELD{name="Attachment" attributes="" title="Attachment" value="<span class=%22twikiNewLink%22>WikisInEnterprise<a rel=%22nofollow%22 href=%22/twiki/bin/edit/Sandbox/WikisInEnterprise?topicparent=Sandbox.DocID20051218224242%22 title=%22Opret denne side%22><sup>?</sup></a></span>.pdf"}%
--
SP
A simple fix for this would be to simply
not call getRenderedVersion for labels. But I can't figure why it is called in the first place, I'd like to get a second opinion if it can just be eliminated. Any ideas?
Index: lib/TWiki/Form.pm
===================================================================
--- lib/TWiki/Form.pm (revision 8760)
+++ lib/TWiki/Form.pm (working copy)
@@ -444,8 +444,7 @@
# necessarily identical to what is in the form? If we can
# take it from the text, we must be sure it cannot be
# changed through the URL?
- my $renderedValue = $session->{renderer}->getRenderedVersion
- ( $session->handleCommonTags( $value, $web, $topic ));
+ my $renderedValue = $session->handleCommonTags( $value, $web, $topic );
$value = CGI::hidden( -name => $name,
-class => 'twikiEditFormLabelField',
-value => $renderedValue );
--
SP
Fixed in SVN 8770.
Rendering must not be done for hidden form field value of label field, but it still needs to be done for the label text that is displayed. (Reverting back to how it was in Cairo.)
Modified: twiki/branches/DEVELOP/lib/TWiki/Form.pm
===================================================================
--- twiki/branches/DEVELOP/lib/TWiki/Form.pm 2006-02-11 02:32:53 UTC (rev 8769)
+++ twiki/branches/DEVELOP/lib/TWiki/Form.pm 2006-02-12 05:41:12 UTC (rev 8770)
@@ -439,16 +439,12 @@
-value => $value );
} elsif( $type eq 'label' ) {
- # Interesting question: if something is defined as "label",
- # could it be changed by applications or is the value
- # necessarily identical to what is in the form? If we can
- # take it from the text, we must be sure it cannot be
- # changed through the URL?
+ # Changed labels through the URL is a feature for TWiki applications
my $renderedValue = $session->{renderer}->getRenderedVersion
( $session->handleCommonTags( $value, $web, $topic ));
$value = CGI::hidden( -name => $name,
-class => 'twikiEditFormLabelField',
- -value => $renderedValue );
+ -value => $value );
$value .= CGI::div( { class => 'twikiEditFormLabelField' },
$renderedValue );
--
PTh
merged in r9211
--
RA
Closed with the release of 4.0.2
KJL