[twill] FOUND THE PROBLEM! (WAS: Re: empty textareas submit newline?)

gabor gabor at nekomancer.net
Wed Mar 8 16:07:09 PST 2006


Titus Brown wrote:
> -> i have a simple webpage with a form with a textarea,
> -> like:
> ->      <form action="" method="get">
> ->          <textarea name="teaser" rows="10" cols="40"></textarea>
> ->      </form>
> -> </body>
> -> 
> -> the problem is that when i go there with twill, and do a submit, it 
> -> submits this:
> -> 
> -> textarea.html?teaser=%0A
> -> 
> -> a newline.
> -> 
> -> a different way to reproduce the problem is to simply use "showforms".
> -> and you will see that for all the should-be-empty textareas the content 
> -> is a newline (there is an empty line below the textarea's line).
> -> 
> -> so, is this a bug or i am doing something very stupid :) ?
> 
> Hi, Gabor,
> 
> in a classic example of a not-good situation... the problem lies deeper
> than I'd like to go for the moment.
> 
> First off, the 'handle_data' function of ClientForm.AbstractFormParser
> gets a newline when there's no text there.  This indicates that the
> problem lies somewhere directly in the parsing code, and not in
> logistical code later on.

hi,

i found the problem.

tidy :)

if i turn it off, then it works fine :)

this has the problem:

================
go http://blabla/page/with/empty/textarea.html
showforms
================

this works fine:

================
config use_tidy 0
go http://blabla/page/with/empty/textarea.html
showforms
================

i assume the problem is, that tidy changes
<textarea></textarea> into

<textarea>
</textarea>

but i am only guessing.

btw. this html: <textarea /> survives fine through tidy.


gabor



More information about the twill mailing list