You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Koen Segers <Ko...@scarlet.be> on 2005/06/15 20:42:14 UTC

tapestry and valid html

Is it possible to tell tapestry to generate valid html?

When I try to validate my webpage, I always get error messages in form fields. 
Stupid error messages like /> where the / isn't allowed...

Greetz
-- 

Koen Segers

<ko...@scarlet.be>
<http://eddyvite.dyndns.org>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: tapestry and valid html

Posted by Koen Segers <Ko...@scarlet.be>.
On Saturday 18 June 2005 04:02, Kent Tong wrote:
> Wait a minute. His problem seems to be the result of Tapestry outputting
> the hidden fields directly after the <form> tag which is not allowed
> by the html specification (strict):
>

It was idd html strict specification I requested.
When I change it to the transitional specification, I only get this error 
there is no attribute "DISPLAYNAME"  for the line
<input type="text" name="loginUserName" value="" displayName="Name"/>
Which I believe is normal, because displayname isn't in the dtd's of html.

> <form method="post" name="Form0" action="/koen/app">
> <input type="hidden" name="service" value="direct/1/Login/loginForm"/>
> <input type="hidden" name="sp" value="S0"/>
> <input type="hidden" name="Form0" value="loginUserName,loginPassword"/>
>
> To solve this problem, the Form component may wrap the hidden
> fields in a <div>:

How can I do that???
This part of the form tag is generated by Tapestry isn't it...

Greetings and thanks for the outstanding help!

-- 

Koen Segers

<ko...@scarlet.be>
<http://eddyvite.dyndns.org>

Re: tapestry and valid html

Posted by Kent Tong <ke...@cpttm.org.mo>.
Howard Lewis Ship <hlship <at> gmail.com> writes:

> Tapestry generates XHTML style output, so it inlcudes a slash before a
> on empty tags.
> 
> The other issues are problems with your input template.  You may need
> to wrap your <form> with a <p> to make W3C validator happy.

Wait a minute. His problem seems to be the result of Tapestry outputting
the hidden fields directly after the <form> tag which is not allowed
by the html specification (strict):

<form method="post" name="Form0" action="/koen/app">
<input type="hidden" name="service" value="direct/1/Login/loginForm"/>
<input type="hidden" name="sp" value="S0"/>
<input type="hidden" name="Form0" value="loginUserName,loginPassword"/>

To solve this problem, the Form component may wrap the hidden
fields in a <div>:

<form method="post" name="Form0" action="/koen/app">
<div>
<input type="hidden" name="service" value="direct/1/Login/loginForm"/>
<input type="hidden" name="sp" value="S0"/>
<input type="hidden" name="Form0" value="loginUserName,loginPassword"/>
</div>

--
Author of an e-Book for learning Tapestry (http://www.agileskills2.org/EWDT)


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: tapestry and valid html

Posted by Howard Lewis Ship <hl...@gmail.com>.
Tapestry generates XHTML style output, so it inlcudes a slash before a
> on empty tags.

The other issues are problems with your input template.  You may need
to wrap your <form> with a <p> to make W3C validator happy.

You can control the !DOCTYPE of the output document using the Shell
component; this may allow you to find a meeting point between what
Tapestry generates and what W3C validates.

Tapestry si driven by pragmatic concerns; the HTML it outputs works in browsers.

On 6/17/05, Koen Segers <Ko...@scarlet.be> wrote:
> > >
> > > Actually this is what tapestry generates:
> > > <form method="post" name="Form0" action="/koen/app">
> > > <input type="hidden" name="service" value="direct/1/Login/loginForm"/>
> > Switched?!   Looks reasonable to me.
> >
> 
> My mistake. They aren't switched ... But it still isn't valid.
> Any ideas?
> I tried a lot of combinations...
> This is what W3C states:
> 
>    1.
> 
>       Line 29, column 68: document type does not allow element "INPUT" here;
> missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV",
> "ADDRESS" start-tag
> 
>       ..." name="service" value="direct/1/Login/loginForm"/>
> 
>       The mentioned element is not allowed to appear in the context in which
> you've placed it; the other mentioned elements are the only ones that are
> both allowed there and can contain the element mentioned. This might mean
> that you need a containing element, or possibly that you've forgotten to
> close a previous element.
> 
>       One possible cause for this message is that you have attempted to put a
> block-level element (such as "<p>" or "<table>") inside an inline element
> (such as "<a>", "<span>", or "<font>").
> 
>       ✉
>    2.
> 
>       Line 29, column 69: character data is not allowed here
> 
>       ...name="service" value="direct/1/Login/loginForm"/>
> 
>       You have used character data somewhere it is not permitted to appear.
> Mistakes that can cause this error include putting text directly in the body
> of the document without wrapping it in a container element (such as a
> <p>aragraph</p>) or forgetting to quote an attribute value (where characters
> such as "%" and "/" are common, but cannot appear without surrounding
> quotes).
> 
>       ✉
>    3.
> 
>       Line 30, column 41: document type does not allow element "INPUT" here;
> missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV",
> "ADDRESS" start-tag
> 
>       <input type="hidden" name="sp" value="S0"/>
> 
>       The mentioned element is not allowed to appear in the context in which
> you've placed it; the other mentioned elements are the only ones that are
> both allowed there and can contain the element mentioned. This might mean
> that you need a containing element, or possibly that you've forgotten to
> close a previous element.
> 
>       One possible cause for this message is that you have attempted to put a
> block-level element (such as "<p>" or "<table>") inside an inline element
> (such as "<a>", "<span>", or "<font>").
> 
>       ✉
>    4.
> 
>       Line 31, column 69: document type does not allow element "INPUT" here;
> missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV",
> "ADDRESS" start-tag
> 
>       ...name="Form0" value="loginUserName,loginPassword"/>
> 
>       The mentioned element is not allowed to appear in the context in which
> you've placed it; the other mentioned elements are the only ones that are
> both allowed there and can contain the element mentioned. This might mean
> that you need a containing element, or possibly that you've forgotten to
> close a previous element.
> 
>       One possible cause for this message is that you have attempted to put a
> block-level element (such as "<p>" or "<table>") inside an inline element
> (such as "<a>", "<span>", or "<font>").
> 
>       ✉
>    5.
> 
>       Line 35, column 78: there is no attribute "DISPLAYNAME"
> 
>       ...e="loginUserName" value="" displayName="Name"/></td>
> 
>       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.
> 
> --
> 
> Koen Segers
> 
> <ko...@scarlet.be>
> <http://eddyvite.dyndns.org>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

Re: tapestry and valid html

Posted by Koen Segers <Ko...@scarlet.be>.
> >
> > Actually this is what tapestry generates:
> > <form method="post" name="Form0" action="/koen/app">
> > <input type="hidden" name="service" value="direct/1/Login/loginForm"/>
> Switched?!   Looks reasonable to me.
>

My mistake. They aren't switched ... But it still isn't valid.
Any ideas?
I tried a lot of combinations...
This is what W3C states:

   1.

      Line 29, column 68: document type does not allow element "INPUT" here; 
missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV", 
"ADDRESS" start-tag

      ..." name="service" value="direct/1/Login/loginForm"/>

      The mentioned element is not allowed to appear in the context in which 
you've placed it; the other mentioned elements are the only ones that are 
both allowed there and can contain the element mentioned. This might mean 
that you need a containing element, or possibly that you've forgotten to 
close a previous element.

      One possible cause for this message is that you have attempted to put a 
block-level element (such as "<p>" or "<table>") inside an inline element 
(such as "<a>", "<span>", or "<font>").

      ✉
   2.

      Line 29, column 69: character data is not allowed here

      ...name="service" value="direct/1/Login/loginForm"/>

      You have used character data somewhere it is not permitted to appear. 
Mistakes that can cause this error include putting text directly in the body 
of the document without wrapping it in a container element (such as a 
<p>aragraph</p>) or forgetting to quote an attribute value (where characters 
such as "%" and "/" are common, but cannot appear without surrounding 
quotes).

      ✉
   3.

      Line 30, column 41: document type does not allow element "INPUT" here; 
missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV", 
"ADDRESS" start-tag

      <input type="hidden" name="sp" value="S0"/>

      The mentioned element is not allowed to appear in the context in which 
you've placed it; the other mentioned elements are the only ones that are 
both allowed there and can contain the element mentioned. This might mean 
that you need a containing element, or possibly that you've forgotten to 
close a previous element.

      One possible cause for this message is that you have attempted to put a 
block-level element (such as "<p>" or "<table>") inside an inline element 
(such as "<a>", "<span>", or "<font>").

      ✉
   4.

      Line 31, column 69: document type does not allow element "INPUT" here; 
missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV", 
"ADDRESS" start-tag

      ...name="Form0" value="loginUserName,loginPassword"/>

      The mentioned element is not allowed to appear in the context in which 
you've placed it; the other mentioned elements are the only ones that are 
both allowed there and can contain the element mentioned. This might mean 
that you need a containing element, or possibly that you've forgotten to 
close a previous element.

      One possible cause for this message is that you have attempted to put a 
block-level element (such as "<p>" or "<table>") inside an inline element 
(such as "<a>", "<span>", or "<font>").

      ✉
   5.

      Line 35, column 78: there is no attribute "DISPLAYNAME"

      ...e="loginUserName" value="" displayName="Name"/></td>

      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.

-- 

Koen Segers

<ko...@scarlet.be>
<http://eddyvite.dyndns.org>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: tapestry and valid html

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jun 17, 2005, at 11:18 AM, Koen Segers wrote:

> On Friday 17 June 2005 03:10, Kent Tong wrote:
>
>> <form name="myform" action="bar">
>> <p><input type="text" name="foo"/>
>>
>
> I used a table for nice alignment:
> <FORM jwcid='loginForm' action="">
>     <table>
>         <tr>
>         <td>Name</td>
>                 <td><input jwcid='loginUserName'/></td>
>     </tr>
>         <tr>
>         <td>Password</td>
>             <td><input jwcid="loginPassword" type="password"
> maxlength="50"/></td>
>     </tr>
>         <tr>
>             <td/>
>         <td align='right'><br>
>         <input class='button' type="submit" value="Log in"  
> maxlength="50">&nbsp;
>             </td>
>         </tr>
>     </table>
> </FORM>
>
> Actually this is what tapestry generates:
> <form method="post" name="Form0" action="/koen/app">
> <input type="hidden" name="service" value="direct/1/Login/loginForm"/>
> <input type="hidden" name="sp" value="S0"/>
> <input type="hidden" name="Form0"  
> value="loginUserName,loginPassword"/>
>     <table>
>         <tr>
>         <td>Name</td>
>                 <td><input type="text" name="loginUserName" value=""
> displayName="Name"/></td>
>     </tr>
>         <tr>
>
>         <td>Password</td>
>             <td><input type="password" name="loginPassword" value=""
> maxlength="50"/></td>
>     </tr>
>         <tr>
>             <td/>
>         <td align='right'><br>
>         <input class='button' type="submit" value="Log in"  
> maxlength="50">&nbsp;
>             </td>
>
>         </tr>
>     </table> </form>
>
> You can see the form and table element are switched.

Switched?!   Looks reasonable to me.


     Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: tapestry and valid html

Posted by Koen Segers <Ko...@scarlet.be>.
On Friday 17 June 2005 03:10, Kent Tong wrote:
> <form name="myform" action="bar">
> <p><input type="text" name="foo"/>

I used a table for nice alignment:
<FORM jwcid='loginForm' action="">
	<table>
        <tr>
		<td>Name</td>
            	<td><input jwcid='loginUserName'/></td>
	</tr>
        <tr>
	    <td>Password</td>
            <td><input jwcid="loginPassword" type="password" 
maxlength="50"/></td>
	</tr>
        <tr>
            <td/>
	    <td align='right'><br>
		<input class='button' type="submit" value="Log in" maxlength="50">&nbsp;
            </td>
        </tr>
    </table>    
</FORM>

Actually this is what tapestry generates:
<form method="post" name="Form0" action="/koen/app">
<input type="hidden" name="service" value="direct/1/Login/loginForm"/>
<input type="hidden" name="sp" value="S0"/>
<input type="hidden" name="Form0" value="loginUserName,loginPassword"/>
	<table>
        <tr>
		<td>Name</td>
            	<td><input type="text" name="loginUserName" value="" 
displayName="Name"/></td>
	</tr>
        <tr>

	    <td>Password</td>
            <td><input type="password" name="loginPassword" value="" 
maxlength="50"/></td>
	</tr>
        <tr>
            <td/>
	    <td align='right'><br>
		<input class='button' type="submit" value="Log in" maxlength="50">&nbsp;
            </td>

        </tr>
    </table> </form>

You can see the form and table element are switched.
Any ideas how to solve this?

I tried it your way, but it looks very ugly...
-- 

Koen Segers

<ko...@scarlet.be>
<http://eddyvite.dyndns.org>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: tapestry and valid html

Posted by Kent Tong <ke...@cpttm.org.mo>.
Koen Segers <KoenSegers <at> scarlet.be> writes:

> 
> Is it possible to tell tapestry to generate valid html?
> 
> When I try to validate my webpage, I always get error messages in form fields. 
> Stupid error messages like /> where the / isn't allowed...

Are you sure about that? The validator is happy with <input.../> such as:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>xxx</title>
</head>
<body>
<form name="myform" action="bar">
<p><input type="text" name="foo"/>
</form>
</body>
</html>

In contrast, if you omit the <p> before <input>, then it will
be an error. So, this is your original html code that is 
invalid, not Tapestry.

--
Author of e-book on Tapestry (http://agileskills2.org/EWDT)



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org