• 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.

Form input fields in edit mode used to be generated as such, for example:

<input class="twikiInputField twikiEditFormTextField" name="IssueName" size=73 tabindex=1 type="text" value="My first defect" />
but now suddenly it is the following
<input class="twikiInputField twikiEditFormTextField" name="IssueName" size=73 tabindex=1 type="text" value="My first defect">

I am not sure whether this is correct? Shouldn't input be a self-terminating construct?

-- TW

Actually, the proper format would be:

<input class="twikiInputField twikiEditFormTextField" name="IssueName" size="73" tabindex="1" type="text" value="My first defect" />

(notice quoted parameters and forward slash.)

Where do you see this input field?

-- PTh

It is generated when going into edit mode. Text input form fields are now rendered as such. This is the reason why all test/unit/InitFormTests.pm are failing suddenly.

However, I cannot see any code changes that could have caused this. I hope this is not related to the version of CGI.pm I am using (3.25).

Could you please do me a favor and run test/unit/InitFormTests.pm and let me know of the results you are getting?

-- TW

It looks like relying on the CGI module too much is biting us. TWiki 4 had a mass change from:

   $text .= "<input type=\"hidden\" name=\"$name\" value\"$value\" />";

to:

   $text .= CGI::hidden( -name => $name, -value => $value );

What was the reason for this change? What is the performance impact? Not just for hidden, but for all HTML. It seems to me, if anything this would be slower, but more consistent... -- TW

-- PTh

Update: The html generated looks OK here on develop.twiki.org/~twiki4, also on my own server with CGI 2.89.

-- PTh

Did you run the unit test?

-- TW

I looked at the raw html when in edit mode. Running tests, with tons of errors...

Relevant ones:

3) InitFormTests.pm:287 - test_tmpl_form_new(InitFormTests)
expected '<input class="twikiInputField twikiEditFormTextField" name="IssueName" size="73" type="text" value="_An issue_" />
', got '<input class="twikiInputField twikiEditFormTextField" name="IssueName" size=73 type="text" value="_An issue_">
'

4) InitFormTests.pm:335 - test_tmpl_form_params(InitFormTests)
expected '<input class="twikiInputField twikiEditFormTextField" name="IssueName" size="73" type="text" value="_An issue_" />
', got '<input class="twikiInputField twikiEditFormTextField" name="IssueName" size=73 type="text" value="_An issue_">
'

5) InitFormTests.pm:359 - test_tmpl_form_existingform_params(InitFormTests)
expected '<input class="twikiInputField twikiEditFormTextField" name="IssueName" size="73" type="text" value="My first defect" />
', got '<input class="twikiInputField twikiEditFormTextField" name="IssueName" size=73 type="text" value="My first defect">
'

6) InitFormTests.pm:239 - test_form(InitFormTests)
expected '<input class="twikiInputField twikiEditFormTextField" name="IssueName" size="73" type="text" value="My first defect" />
', got '<input class="twikiInputField twikiEditFormTextField" name="IssueName" size=73 type="text" value="My first defect">
'

7) InitFormTests.pm:263 - test_tmpl_form(InitFormTests)
expected '<input class="twikiInputField twikiEditFormTextField" name="IssueName" size="73" type="text" value="My first defect" />
', got '<input class="twikiInputField twikiEditFormTextField" name="IssueName" size=73 type="text" value="My first defect">
'

8) InitFormTests.pm:383 - test_tmpl_form_new_params(InitFormTests)
expected '<input class="twikiInputField twikiEditFormTextField" name="IssueName" size="73" type="text" value="My first defect" />
', got '<input class="twikiInputField twikiEditFormTextField" name="IssueName" size=73 type="text" value="My first defect">
'

9) InitFormTests.pm:407 - test_tmpl_form_notext_params(InitFormTests)
expected '<input class="twikiInputField twikiEditFormTextField" name="IssueName" size="73" type="text" value="My first defect" />
', got '<input class="twikiInputField twikiEditFormTextField" name="IssueName" size=73 type="text" value="My first defect">
'

10) InitFormTests.pm:311 - test_tmpl_form_existingform(InitFormTests)
expected '<input class="twikiInputField twikiEditFormTextField" name="IssueName" size="73" type="text" value="_An issue_" />
', got '<input class="twikiInputField twikiEditFormTextField" name="IssueName" size=73 type="text" value="_An issue_">
'

11) InitFormTests.pm:435 - test_dont_expand_on_edit(InitFormTests)
expected '<input class="twikiInputField twikiEditFormTextField" name="IssueName" size="73" type="text" value="My first defect" />
', got '<input class="twikiInputField twikiEditFormTextField" name="IssueName" size=73 type="text" value="My first defect">
'

-- PTh


Thanks. As you can see, the HTML generated is
<input class="twikiInputField twikiEditFormTextField" name="IssueName" size=73 type="text" value="_An issue_">

I am surprised that you would see the right HTML in the final page... -- TW


I wonder whether this is actually a change in the supporting library loaded for the test case, rather than the TWiki code? I'll have to study this some more... -- TW


There were three reasons for the change. (1) readibility of the code (2) maintenance by a wider audience (3) standards compliance. It was (and still is IMHO) perfectly reasonable to expect that the CGI module would do a better job of generating HTML - and most especially XHTML compliant HTML. Not all coders can be expected to be HTML experts as well. The perfomance impact is irrelevant (the only overhead is a function call which is compiled away on the first call).

The initFormTests should probably be written to use TWikiTestCase::html_equals, which deals with this situation. The third party module you are using is broken, I believe (I can't even to get it to install without force)

CC

CC, I have asked you this question before (in Bugs.Item3144) but did not get an answer: I cannot get your TWikiTestCase::html_equals to work. Is there any magic that needs to take place? -- TW

The two functions are assert_html_equals and assert_html_matches. The first parses the two HTMLs using HTML::Parser to generate a parse tree, which it then serialises. It then compares the serialised versions Algorithm::Diff. It should be pretty robust. The second does a tolerant regular expression match on a fragment of HTML to see if it exists in another block of text. It is not robust. Both functions were originally written for use with the TestCasePlugin, but are used in the unit tests for several of my plugins as well.

If you can raise a bug showing two blocks of equal HTML that fail an assert_html_equals test, I can take a look.

CC


Seems that this was a problem with the CPAN libraries used in test case. That library appears to have changed... discard... -- TW

ItemTemplate
Summary Input fields in form during edit generate wrong (?) HTML
ReportedBy TWiki:Main.ThomasWeigert
Codebase ~twiki4
SVN Range TWiki-4.1.0, Tue, 02 Jan 2007, build 12418
AppliesTo Engine
Component

Priority Normal
CurrentState No Action Required
WaitingFor

Checkins

TargetRelease n/a
Edit | Attach | Watch | Print version | History: r14 < r13 < r12 < r11 < r10 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r14 - 2007-01-08 - ThomasWeigert
 
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