Very interesting. First, the validator is correct. The <table> tag does not accept <input> elements as a child -- obviously an error. This is a problem with the Struts output -- it isn't paying attention that it is rendering a table with its layout and thus emitting bad HTML.
This sounds like a ticket. Would you please submit one? On Thu, Mar 6, 2014 at 2:01 PM, Fredrik Andersson <fredan...@hotmail.com>wrote: > Hello guys! > Yes. the textarea validates fine without the wrap attribute. So I guess I > have to skip it. > > I have tride to put the hidden attributet att: > 1 first code line after the form-start-tag > 2 before the submit-tag > 3 after the submit-tag, before form-end-tag. > None of the attempt validates. > So If you guys got any idea how to solve this mystery plast let me know. > > Best regards > Fredrik > > > --- Originalmeddelande --- > > Från: "Dave Newton" <davelnew...@gmail.com> > Skickat: 6 mars 2014 17:57 > Till: "Struts Users Mailing List" <user@struts.apache.org> > Ämne: Re: Why do I get this XHTML validation errors? (second attempt) > > I think the issue with the hidden elements is that they're not rendering in > a table row, and I don't think you're supposed to have elements in-between > (or before/after) a table's rows. > > > On Thu, Mar 6, 2014 at 11:48 AM, Chris Pratt <thechrispr...@gmail.com > >wrote: > > > Did you try moving the <s:hidden> elements to the top of the form, or > > removing the wrap="hard" from your <s:textarea>? > > (*Chris*) > > > > > > On Thu, Mar 6, 2014 at 5:13 AM, Fredrik Andersson <fredan...@hotmail.com > > >wrote: > > > > > Hello guys! > > > > > > I trying to produce a app that renders in XHTML. > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " > > > http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > > <html xmlns="http://www.w3.org/1999/xhtml"> > > > > > > How ever I got a form looking like this: > > > > > > <s:form action="productcommentssave"> > > > <s:textfield name="productComment.emailAddress" label="Email address" > > > labelposition="top" maxlength="128" size="40" /> > > > <s:textfield name="productComment.subject" label="Subject" > > > labelposition="top" maxlength="128" size="40" /> > > > <s:textarea name="productComment.text" label="Message (max 1024 chars)" > > > cols="52" rows="5" labelposition="top" wrap="hard"/> > > > <s:submit /> > > > <s:hidden name="PRODUCTCOMMENTSACTION_FORM_TOKEN_NAME" > > > value="%{formToken}" /> > > > <s:hidden name="productid" value="%{product.id}" /> > > > </s:form> > > > > > > This gets rendered like: > > > 25 <form id="productcommentssave" name="productcommentssave" > > > action="/productcommentssave.action" method="post"> > > > 26 <table class="wwFormTable"> > > > 27 <tr> > > > 28 <td align="left" valign="top" colspan="2"><label > > > for="productcommentssave_productComment_emailAddress" > class="label">Email > > > address:</label></td> > > > 29 </tr> > > > 30 <tr> > > > 31 <td > > > 32><input type="text" name="productComment.emailAddress" size="40" > > > maxlength="128" value="" > > > id="productcommentssave_productComment_emailAddress"/></td> > > > 33 </tr> > > > 34 > > > 35 > > > 36 <tr> > > > 37 <td align="left" valign="top" colspan="2"><label > > > for="productcommentssave_productComment_subject" > > > class="label">Subject:</label></td> > > > 38 </tr> > > > 39 <tr> > > > 40 <td > > > 41><input type="text" name="productComment.subject" size="40" > > > maxlength="128" value="" > > > id="productcommentssave_productComment_subject"/></td> > > > 42 </tr> > > > 43 > > > 44 > > > 45 <tr> > > > 46 <td align="left" valign="top" colspan="2"><label > > > for="productcommentssave_productComment_text" class="label">Message > (max > > > 1024 chars):</label></td> > > > 47 </tr> > > > 48 <tr> > > > 49 <td > > > 50><textarea name="productComment.text" cols="52" rows="5" wrap="hard" > > > id="productcommentssave_productComment_text"></textarea></td> > > > 51 </tr> > > > 52 > > > 53 > > > 54 <tr> > > > 55 <td colspan="2"><div align="right"><input type="submit" > > > id="productcommentssave_0" value="Submit"/> > > > 56 </div></td> > > > 57</tr> > > > 58 > > > 59 > > > 60 <input type="hidden" name="PRODUCTCOMMENTSACTION_FORM_TOKEN_NAME" > > > value="1394108222515" > > > id="productcommentssave_PRODUCTCOMMENTSACTION_FORM_TOKEN_NAME"/> > > > 61 <input type="hidden" name="productid" value="3" > > > id="productcommentssave_productid"/> > > > 62 </table></form> > > > > > > From http://validator.w3.org/#validate_by_input+with_options I > validate > > > it and get these 3 anoying errors: > > > > > > Error Line 50, Column 63: there is no attribute "wrap" > > > ...Comment.text" cols="52" rows="5" wrap="hard" > > > id="productcommentssave_productCo... > > > You have used the attribute named above in your document, but the > > document > > > type you are using does not support that attribute for this element. > This > > > error is often caused by incorrect use of the "Strict" document type > > with a > > > document that uses frames (e.g. you must use the "Transitional" > document > > > type to get the "target" attribute), or by using vendor proprietary > > > extensions such as "marginheight" (this is usually fixed by using CSS > to > > > achieve the desired effect instead). > > > This error may also result if the element itself is not supported in > the > > > document type you are using, as an undefined element will have no > > supported > > > attributes; in this case, see the element-undefined error message for > > > further information. > > > How to fix: check the spelling and case of the element and attribute, > > > (Remember XHTML is all lower-case) and/or check that they are both > > allowed > > > in the chosen document type, and/or use CSS instead of this attribute. > If > > > you received this error when using the <embed> element to incorporate > > flash > > > media in a Web page, see the FAQ item on valid flash. > > > > > > Error Line 60, Column 161: document type does not allow element "input" > > > here > > > ...1394108222515" > > > id="productcommentssave_PRODUCTCOMMENTSACTION_FORM_TOKEN_NAME"/> > > > The element named above was found in a context where it is not allowed. > > > This could mean that you have incorrectly nested elements -- such as a > > > "style" element in the "body" section instead of inside "head" -- or > two > > > elements that overlap (which is not allowed). > > > One common cause for this error is the use of XHTML syntax in HTML > > > documents. Due to HTML's rules of implicitly closed elements, this > error > > > can create cascading effects. For instance, using XHTML's > "self-closing" > > > tags for "meta" and "link" in the "head" section of a HTML document may > > > cause the parser to infer the end of the "head" section and the > beginning > > > of the "body" section (where "link" and "meta" are not allowed; hence > the > > > reported error). > > > > > > Error Line 61, Column 93: document type does not allow element "input" > > here > > > ...t type="hidden" name="productid" value="3" > > > id="productcommentssave_productid"/> > > > (same as at line 60) > > > > > > Do you guys see anything that I could do to correct this? I would love > to > > > have a app with correct xhtml. > > > > > > Best regards > > > Fredrik > > > > > > -- > e: davelnew...@gmail.com > m: 908-380-8699 > s: davelnewton_skype > t: @dave_newton <https://twitter.com/dave_newton> > b: Bucky Bits <http://buckybits.blogspot.com/> > g: davelnewton <https://github.com/davelnewton> > so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- Cheers, Paul