in reply to Perl truncating HTML form input

This html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>test</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1 +"> </head> <body> <form action='z/bin/test.cgi' method='post'> <textarea name='textinputs'>In a village of (as in your post)</textare +a> <input type='hidden' name='foo' value='foo'> <input type='submit'> </form> </body> </html>
and script
#!/usr/local/bin/perl use strict; use CGI qw/ :standard /; print "Content-type: text/html\n\n"; print "<html>\n"; print Dump; print "</html>\n";
gave
<html> <ul> <li><strong>textinputs</strong></li> <ul> <li>In a village of La Mancha, ... telling of it. <br /> <br /> You must know, then, that the above-named ... thoughts prevented him. + </li> </ul> <li><strong>foo</strong></li> <ul> <li>foo</li> </ul> </ul></html>
I've truncated the text but it shows that all of it was returned. There is also the foo field there. This is the hidden field you have in your html. This doesn't show in your output.

Are you sure you are looking at the files (html/cgi) that you think you are? This is often the reason when I hit frustating snags like this. :-)

Good luck!

Replies are listed 'Best First'.
Re^2: Perl truncating HTML form input
by sstevens (Scribe) on Apr 10, 2008 at 18:33 UTC
    What the? I am _positive_ I'm running the same code that I posted. I promise, I copy-pasted. Maybe it has to do with the DOCTYPE tag? Hm.

    What version of Perl are you running?

    In regards to foo not showing up in my output, that was just one of the side effects (affects?). The Quixote text was truncated and I would lose any inputs (hidden or otherwise) from the form that occur after the Quixote textarea.

    Update: After being baffled by wfsp's reply, I've tried a few hundred things. I finally moved the two files (blank.html and spellchecker.pl) to a different domain on the same server. It worked! The exact same files with the same permissions worked! I noticed that mod_perl was not enabled for the domain (domain A) that the script worked, and it was on for the domain (domain B) that the script didn't work. I turned on mod_perl for domain A and the script stopped working! I got really excited and turned mod_perl off again... but then it still didn't work. I tried it a few times and sometimes it would work and sometimes it wouldn't. I know that's hard to believe. There must be some kind of user error here, right?

    I thought it might be a browser issue, so I tried IE 6. It consistently doesn't work for IE 6.

    If I saw this thread, I would think to myself that the person was screwing something up. I'm not saying that I'm not screwing something up, but it isn't as simple as calling the wrong script. I've copied this stuff over to an accessible location, in case someone wants to try it out.


    And now it's working consistently. I have no idea what's going on. :(
      It doesn't have anything to do with perl version, maybe apache version, CGI.pm version , browser version, but not perl version.