niche Posted June 7, 2012 Share Posted June 7, 2012 (edited) I'm trying to move this site from transitional to a strict doctype and it doesn't like this form (at least it didn't throw an error until I added the form). What should I be understanding? echo '<form action="see_cart.php" method="post">'; echo '<input type="hidden" name="user" value="' . $fn_upper . '" >'; echo '<input type="submit" class="cart" value="See Cart" >';echo '</form>'; I get three errors: Line 249, Column 564: document type does not allow element "INPUT" here; missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV", "ADDRESS" start-tag Line 249, Column 617: document type does not allow element "INPUT" here; missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV", "ADDRESS" start-tag Line 249, Column 624: end tag for "FORM" which is not finished here's the link: http://www.lincolnsr...111_debuger.php Edited June 8, 2012 by niche 1 Link to comment Share on other sites More sharing options...
birbal Posted June 7, 2012 Share Posted June 7, 2012 you should close the input tags Link to comment Share on other sites More sharing options...
niche Posted June 7, 2012 Author Share Posted June 7, 2012 (edited) I worked with that previously. Closing them added another error. New link with closed tags: http://www.lincolnsrealdeals.com/temp111_debuger.php Edited June 7, 2012 by niche Link to comment Share on other sites More sharing options...
Ingolme Posted June 7, 2012 Share Posted June 7, 2012 <input> elements or other inline elements cannot be placed directly inside a form, you need a block element to surround them. That's why you're getting a validation error. If your document is HTML, you don't need to close the <input> tags. 1 Link to comment Share on other sites More sharing options...
niche Posted June 8, 2012 Author Share Posted June 8, 2012 That worked Ingolme. Thank you very much. I know you can't know, but how could I not know that??? I've never wrapped inputs in a <p> before. Is there a ref for that in w3schools you're aware of? If not, is there another ref you can think of? This is a pretty basic omission. It would be nice to get some idea how I missed that. Maybe it's just the "strict" that forced the issue for me finally. Link to comment Share on other sites More sharing options...
Guest So Called Posted June 8, 2012 Share Posted June 8, 2012 I wondered that too. Truth be told I spent 20-25 minutes on your form problem just because I was curious if I could solve it. I compared your form to my contact form and didn't see why mine works and yours didn't. After reading Ingol's reply I realized that I too put my <INPUT> elements inside <P> elements. I read and re-read the W3S docco on <FORM> and never saw any indication that <INPUT> needed a block. If the <INPUT> docco says to use a block around it I never saw that. <FORM> is a block element and you'd think that would be enough. 1 Link to comment Share on other sites More sharing options...
niche Posted June 8, 2012 Author Share Posted June 8, 2012 Must be some strict thing. That's one requirement I won't soon forget. Thanks for all your help birbal, Ingolme, and So Called. It's time to call it a day. Link to comment Share on other sites More sharing options...
dsonesuk Posted June 8, 2012 Share Posted June 8, 2012 hhhhmmmmaaaa inputs are not/or don't act as totally inline, more like inline-block, with input elements you can define width/height, true inline width/height depends on content within it .if you look up inputs under http://www.w3.org/ they are listed as form controls, but can't find any reason why they should NOT be allowed without being surrounded by block element, other-than well they say they should be. Yet! another stupid Strict doctype rule, No iframes, now no inputs within form unless surrounded by black element . 1 Link to comment Share on other sites More sharing options...
niche Posted June 8, 2012 Author Share Posted June 8, 2012 Well put dsonesuk. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now