[twill] empty textareas submit newline?

Gábor Farkas gabor at nekomancer.net
Mon Mar 6 00:44:10 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.
> Secondly, only a single newline occurs even when there's a newline
> explicitly in place, e.g.
> <textarea></textarea>
> and
> <textarea>
> </textarea>
> give identical results.
> This means that I can't hack in a fix without potentially causing
> trouble to people who *want* a newline!  Sigh.
> How big a problem is this for you at the moment?  Can I safely ignore
> it, or is this causing you real trouble?


thanks for the investigation.

right now i can work around it easily ( i was simply testing the case 
that the user submits an "empty" form. so instead of just submitting 
what i get, i will manually set the textareas to '' (empty string). no 
problem for now)..

but maybe a known-bugs webpage would be a good idea for now, so that 
other will know that this is happening...


More information about the twill mailing list