View Full Version : do form elements have to be in a form to be valid?
tk403
12-03-2008, 02:22 AM
For instance, can I have
<li><a href=#>Value of My Car</a><input type="text"></li>
But not within <form> tags?
The idea is that the <input> field would be filled in with data coming from the server, calculated from other places.
Schmoopy
12-03-2008, 02:28 AM
I don't personally know, but just write the code, then upload it to the HTML validator here: http://validator.w3.org/
And it should say whether it's valid or not.
Edit: Pretty sure it's valid, just made a mock-up version but the validator didn't pick it up as an error.
Also make sure you end the <input> tag with a / like this: <input type="text"/> or W3 will tell you you have errors, using doctype XHTML Transitional anyway.
tk403
12-03-2008, 04:02 AM
Thanks! Yeah I'll remember to close the tag too. :)
Medyman
12-03-2008, 06:33 PM
The INPUT element defines a form control for the user to enter input. While INPUT is most useful within a FORM, HTML 4 allows INPUT in any block-level or inline element other than BUTTON. However, old browsers such as Netscape 4.x will not display any INPUT elements outside of a FORM.
http://htmlhelp.com/reference/html40/forms/input.html
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.