[twill] empty textareas submit newline?
Titus Brown
titus at caltech.edu
Sun Mar 5 23:57:10 PST 2006
-> 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?
--titus
More information about the twill
mailing list