PDA

View Full Version : ASP.NET & XHTML MP 1.0 compliance



enewmen
07-09-2009, 08:18 PM
Guys.

I've been programming mobi in ASP.NET for a while with some luck.
However, in the ready.mobi test, I ALWAYS fail the XHTML Mobile Profile test and Valid Markup test. Yes, I did LOTS of searching already.
It seems ANY Form will fail this test. (I got a score of 5 using pure HTML)

I'm just trying to do simple stuff. You know, a textbox, label, etc. and a submit button going to the code-behind.

Basically, I use Visual Studio 2008, C#, Web Application Forms, .NET 3.5, HTML 4.0 controls. (This seems to work best after countless hours of frustration).

The DOCTYPE is
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">

I must be missing something basic. I REALLY HOPE to find the answer.

Thanks!
(btw, this forum is awesome).

enewmen
07-11-2009, 03:57 AM
I'm getting no replies :( Is it really so hard to get xHTML MP compliance using Visual Studio 2008?

Scandiman
07-11-2009, 05:54 AM
Most people here use PHP, but there are a few asp.net coders. Perhaps you can get some insights at mobiforge, http://mobiforge.com/asp-net

gogo
07-11-2009, 07:40 AM
forms can validate fine on ready.mobi - I just checked one.

have you tried checking it with the W3 validator http://validator.w3.org/#validate_by_uri
which gives more specific messages.

ready.mobi doesn't like anything that isn't inside a div, p, h or other tag and if you have css in your doc head with any comments in it you get mystery errors. Also sometimes it objects to empty spaces in markup.

You could try comparing your form with one that does validate? This doesn't sound like an ASP problem to me.


these might be relevant
http://mobiforge.com/forum/developing/mobile-development/problems-validating-aspnet-forms
http://forums.asp.net/t/1314153.aspx
http://forums.asp.net/t/1405148.aspx

Andres Kello
07-11-2009, 10:32 AM
Hi enewman, if you click on the "Valid Markup" link in the "Dotmobi compliance tests", the Ready.mobi tool will actually tell you exactly where and why you are failing the validation.

Have a read through the errors and see if that helps you validate and fix the code. If you're still having difficulty, post the errors here and we'll give you a hand.

enewmen
07-11-2009, 10:54 AM
Thank you for the excellent comments! I will try your suggestions.. The links also gave me some ideas.
I did click on the Valid Markup and I was able to slowly increase my score. One test I always fail is the XHTML Mobile Profile.
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
Here is another one I always get wrong:
<body>
<form method="post" action="/index.aspx" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"

FAIL near line 60 column 12
The content of element type "form" must match "(h1|h2|h3|h4|h5|h6|ul|ol|dl|p|div|pre|blockquote|a ddress|hr|table|fieldset)+".

These errors give me a "Error 502, can't load page"

The other solutions I'm able to find myself.

:)

GijsZePa
07-12-2009, 05:38 AM
Add this to your web.config:



<configuration>

<system.web>
.........
..........

<xhtmlConformance mode="Strict" />

</system.web>

</configuration>




Thank you for the excellent comments! I will try your suggestions.. The links also gave me some ideas.
I did click on the Valid Markup and I was able to slowly increase my score. One test I always fail is the XHTML Mobile Profile.
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
Here is another one I always get wrong:
<body>
<form method="post" action="/index.aspx" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"

FAIL near line 60 column 12
The content of element type "form" must match "(h1|h2|h3|h4|h5|h6|ul|ol|dl|p|div|pre|blockquote|a ddress|hr|table|fieldset)+".

These errors give me a "Error 502, can't load page"

The other solutions I'm able to find myself.

:)

gogo
07-12-2009, 11:27 AM
<body>
<form method="post" action="/index.aspx" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"

FAIL near line 60 column 12
The content of element type "form" must match "(h1|h2|h3|h4|h5|h6|ul|ol|dl|p|div|pre|blockquote|a ddress|hr|table|fieldset)+".

These errors give me a "Error 502, can't load page"



Hi have you tried putting the form inside a <div>
and then after the <form> tag try creating another <div> that contains all the <input> tags inside the form.

imo a lot of probs you get on ready.mobi are solved by just creating new divs.

HTH.

enewmen
07-12-2009, 11:28 AM
Hi have you tried putting the form inside a <div>
and then after the <form> tag try creating another <div> that contains all the <input> tags inside the form.

imo a lot of probs you get on ready.mobi are solved by just creating new divs.

HTH.
Yes, I will try this and all the other suggestions people have.
Thanks again!