Hi,
I've been trying to get a ASP.NET site I'm working on validated as HTML 4.01
Transitional but I've run into a couple of problems - actually the only ones
left before the page is validated...
1: the ID tags on serverside controls start with a char which is not allowed
(in this case '_'), example is a Label:
<span id="_ctl0_labDate">
2: postback buttons (inputs with type submit) gets a language parameter
defined which is not allowed in transitional:
<input name="_ctl0:btnAddPreDefined" value="Lgg till" onclick="if
(typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "
language="javascript" id="_ctl0_btnAddPreDefined" type="submit">Forgot the question :)
Anyone know how to fix the problems I described?
Thanks in advance
// Fredrik
"Fredrik Elestedt" <noname@.nospam.now> wrote in message
news:%231BN9a00EHA.2452@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I've been trying to get a ASP.NET site I'm working on validated as HTML
> 4.01 Transitional but I've run into a couple of problems - actually the
> only ones left before the page is validated...
> 1: the ID tags on serverside controls start with a char which is not
> allowed (in this case '_'), example is a Label:
> <span id="_ctl0_labDate">
> 2: postback buttons (inputs with type submit) gets a language parameter
> defined which is not allowed in transitional:
> <input name="_ctl0:btnAddPreDefined" value="Lgg till" onclick="if
> (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "
> language="javascript" id="_ctl0_btnAddPreDefined" type="submit">
>
> I've been trying to get a ASP.NET site I'm working on validated as HTML
4.01
Why?
Do your pages behave the way you would like them to in the browsers you
tested?
If so, what's the problem? If not, why don't you fix them?
Bob Lehmann
"Fredrik Elestedt" <noname@.nospam.now> wrote in message
news:%231BN9a00EHA.2452@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I've been trying to get a ASP.NET site I'm working on validated as HTML
4.01
> Transitional but I've run into a couple of problems - actually the only
ones
> left before the page is validated...
> 1: the ID tags on serverside controls start with a char which is not
allowed
> (in this case '_'), example is a Label:
> <span id="_ctl0_labDate">
> 2: postback buttons (inputs with type submit) gets a language parameter
> defined which is not allowed in transitional:
> <input name="_ctl0:btnAddPreDefined" value="Lgg till" onclick="if
> (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "
> language="javascript" id="_ctl0_btnAddPreDefined" type="submit">
>
Hello Fredrik,
> 1: the ID tags on serverside controls start with a char which is not
> allowed
> (in this case '_'), example is a Label:
> <span id="_ctl0_labDate">
You can avoid this by giving the containing control an ID instead of omittin
g it.
<form runat="server"/>
<asp:Label ID="labDate" Runat="server"/>
</form>
Generates what you are seeing - instead try:
<form ID="myForm" runat="server"/>
<asp:Label ID="labDate" Runat="server"/>
</form>
this generates "myForm_labDate" as an ID for the label.
> 2: postback buttons (inputs with type submit) gets a language
> parameter
> defined which is not allowed in transitional:
> <input name="_ctl0:btnAddPreDefined" value="Lgg till" onclick="if
> (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "
> language="javascript" id="_ctl0_btnAddPreDefined" type="submit">
I have never noticed this? But a solution could be to apply a page filter to
your page, that post-processes the output to ensure validity. It's not the
prettiest solution, but for .NET 1.1 I think it is the best. A good article
on the subject, albeit XHTM
L output: http://www.aspnetresources.com/arti...ttpFilters.aspx
They behave as I want - but only because the browsers tested doesn't follow
the W3C standard ti the letter...
I don't know how to fix it since the names are genereated by ASP.NET
// Fredrik
"Bob Lehmann" <nospam@.dontbotherme.zzz> wrote in message
news:%23Bmqdy10EHA.3704@.tk2msftngp13.phx.gbl...
> 4.01
> Why?
> Do your pages behave the way you would like them to in the browsers you
> tested?
> If so, what's the problem? If not, why don't you fix them?
> Bob Lehmann
> "Fredrik Elestedt" <noname@.nospam.now> wrote in message
> news:%231BN9a00EHA.2452@.TK2MSFTNGP10.phx.gbl...
> 4.01
> ones
> allowed
>
Thanks for the reply,
I have an ID on the form though - but .NET still sets it to __aspNetForm
Don't know how to override this...
// Fredrik
"Micael Baerens" <removethis-micaelbaerens@.gmail.com> wrote in message
news:enWE$s40EHA.1076@.TK2MSFTNGP09.phx.gbl...
> Hello Fredrik,
>
> You can avoid this by giving the containing control an ID instead of
> omitting it.
> <form runat="server"/>
> <asp:Label ID="labDate" Runat="server"/>
> </form>
> Generates what you are seeing - instead try:
> <form ID="myForm" runat="server"/>
> <asp:Label ID="labDate" Runat="server"/>
> </form>
> this generates "myForm_labDate" as an ID for the label.
>
> I have never noticed this? But a solution could be to apply a page filter
> to your page, that post-processes the output to ensure validity. It's not
> the prettiest solution, but for .NET 1.1 I think it is the best. A good
> article on the subject, albeit XHTML output:
> http://www.aspnetresources.com/arti...ttpFilters.aspx
>
Hello Fredrik,
> I have an ID on the form though - but .NET still sets it to
> __aspNetForm Don't know how to override this...
This seems very wierd - what version of .NET are you using?
When I use the following on .NET 1.1:
<html>
<head>
<title>X</title>
</head>
<body>
<form id="myForm" method="post" runat="server">
<asp:Label ID="labDate" Runat="server"/>
</form>
</body>
</html>
I get the following output:
<html>
<head>
<title>X</title>
</head>
<body>
<form method="post" action="X.aspx" id="myForm">
<div><input type="hidden" name="__VIEWSTATE" value="dDw5MjMzODA0MjI7Oz4c0eeC
9LGZJ2oNUcAEtyn4P0c3nQ==" /></div>
<span id="labDate"></span>
</form>
</body>
</html>
(the control isn't actually prefixed by myForm as I wrote earlier).
Kind Regards,
Micael Baerens (removethis-micaelbaerens@.gmail.com)
I have .NET 1.1 SP1 running on Win2k3
That is what my page looks like - except that there are alot more
components...
I found what causes that error - I'm using a template system...
For some reason it overrides the ID on the form to
__aspnetFormwould be nice to fix this - tried setting it programmatically,
no difference.// Fredrik
"Micael Baerens" <removethis-micaelbaerens@.gmail.com> wrote in message
news:%23Y7gBs50EHA.3452@.TK2MSFTNGP14.phx.gbl...
> Hello Fredrik,
>
> This seems very wierd - what version of .NET are you using?
> When I use the following on .NET 1.1:
> <html>
> <head>
> <title>X</title>
> </head>
> <body>
> <form id="myForm" method="post" runat="server">
> <asp:Label ID="labDate" Runat="server"/>
> </form>
> </body>
> </html>
> I get the following output:
> <html>
> <head>
> <title>X</title>
> </head>
> <body>
> <form method="post" action="X.aspx" id="myForm">
> <div><input type="hidden" name="__VIEWSTATE"
> value=" dDw5MjMzODA0MjI7Oz4c0eeC9LGZJ2oNUcAEtyn4
P0c3nQ==" /></div>
> <span id="labDate"></span>
> </form>
> </body>
> </html>
> (the control isn't actually prefixed by myForm as I wrote earlier).
> Kind Regards,
> Micael Baerens (removethis-micaelbaerens@.gmail.com)
>
Well,
I managed, finally, to get it to set the id on the label to testing_labDate
instead of __labDate.
In the loaded template control I added this.ID = "testing";
But the form ID is unfortunantly still __aspnetForm
Any ideas?
"Micael Baerens" <removethis-micaelbaerens@.gmail.com> wrote in message
news:%23Y7gBs50EHA.3452@.TK2MSFTNGP14.phx.gbl...
> Hello Fredrik,
>
> This seems very wierd - what version of .NET are you using?
> When I use the following on .NET 1.1:
> <html>
> <head>
> <title>X</title>
> </head>
> <body>
> <form id="myForm" method="post" runat="server">
> <asp:Label ID="labDate" Runat="server"/>
> </form>
> </body>
> </html>
> I get the following output:
> <html>
> <head>
> <title>X</title>
> </head>
> <body>
> <form method="post" action="X.aspx" id="myForm">
> <div><input type="hidden" name="__VIEWSTATE"
> value=" dDw5MjMzODA0MjI7Oz4c0eeC9LGZJ2oNUcAEtyn4
P0c3nQ==" /></div>
> <span id="labDate"></span>
> </form>
> </body>
> </html>
> (the control isn't actually prefixed by myForm as I wrote earlier).
> Kind Regards,
> Micael Baerens (removethis-micaelbaerens@.gmail.com)
>
Hello Fredrik,
> I managed, finally, to get it to set the id on the label to
> testing_labDate
> instead of __labDate.
> In the loaded template control I added this.ID = "testing";
> But the form ID is unfortunantly still __aspnetForm Any ideas?
I don't know which templating solution you are using, but options might incl
ude inheriting from the template class to change the behaviour if possible,
using the page filtering solution as described earlier or maybe manipulating
the form to set a differen
t ID, like:
Control control = Page.FindControl( "__aspnetForm" );
control.ID = "aspnetForm";
though this is very hacky and may cause something to stop working.
Kind Regards,
Micael Baerens (removethis-micaelbaerens@.gmail.com)
Monday, March 26, 2012
W3C validation
Labels:
01transitional,
asp,
couple,
html,
net,
run,
validated,
validation,
w3c,
working
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment