How to handle orphaned form elements

Jeff Pohlmeyer <[email protected]> Mon, 28 Nov 2005 17:33:23 -0800 (PST)
Newsgroups gmane.comp.web.html-tidy.devel
Message-ID <[email protected]>
Greetings, my old friends. It's been a while since I
last visited Tidytown, hope you all are well.

I have run into another one of those "what the author intended" 
problems, and I am wondering if this would qualify as a bug, or
possibly just a feature request...

One of the more popular portal sites has a login page with some 
garbage that looks something like this:


<div>
<form method="GET" action="">
<input name="login" value="guest">
<input type="submit" value="click me">
</div>
<input type="hidden" name="password" value="secret">
</form>


Firefox, IE, and even Lynx all see the error above as a 
premature </div> tag, and generate the following request:

  http://.../loginform.html?login=guest&password=secret




But tidy "fixes" the error as a missing </form> tag, 
and an stray <input> tag:


<div>
<form method="get" action=""><input name="login" value="guest">
<input type="submit" value="click me">
</form>
</div>
<form>
<input type="hidden" name="password" value="secret">
</form>


Now the submit request doesn't get the password:
  http://.../loginform.html?login=guest


Should this be considered a bug?

I guess there really isn't a single "right" way to correct the error.

For instance, an interactive text editor might actually prefer the 
current tidy behavior, since it encourages the user to fix the mistake.

But for a more automated repair process I would expect tidy to give me
back a document that still functions like the original did.

Maybe there could be a "TidyMergeStrayFormElements" option or something?


Regards, 
 - Jeff





--



		
__________________________________________
Yahoo! DSL – Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click