Mantis doesn't validate XHTML -- not even close

General discussion of Mantis.

Moderators: Developer, Contributor

jrmarino
Posts: 13
Joined: 11 Feb 2007, 19:01

Mantis doesn't validate XHTML -- not even close

Post by jrmarino »

I have embedded Mantis into my site, www.synsport.com, as I assume many others have. Normally I code all my web pages XHTML 1.0 Strict, but due to PHPBB (XHTML valid skin) and Mantis I had to drop down to XHTML 1.0 Transitional. Today I performed a validation check on my site using W3C validator and received a lot of errors, serious errors like nested forms, unclosed form tags, illegal tags, etc. Then I came to this site and performed a validation check on the mantis instance here, with the same results.

Has nobody bothered to validate these generated pages? This isn't a case where it was valid, then a tweak broke it. Are people aware of this, and is there any intention on providing XHTML 1.0 Transitional pages which the doctype dictates?
srouleau
Posts: 16
Joined: 03 Aug 2005, 02:30

Post by srouleau »

Doesn't suprise me; I tried running Mantis behind a proxy, which rewrites the HTML as it goes through, and got all sorts of weird results. In the end I had to turn off rewriting completely.
vboctor
Site Admin
Posts: 1304
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Post by vboctor »

Initially Mantis was generating HTML and we did a lot of work to move it to XHTML. However, we haven't yet made it pass the validator checks. I would be happy to provide the appropriate access for someone to be able to commit changes that fix such XHTML compliance issues.
Migrate your MantisBT to the MantisHub Cloud
jrmarino
Posts: 13
Joined: 11 Feb 2007, 19:01

Post by jrmarino »

would you accept modified files from version 1.0.6 and use a diff program like winmerge to incorporate the submitted changes to the dev branch?
vboctor
Site Admin
Posts: 1304
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Post by vboctor »

Would it be easy for your to provide me with modified files against 1.1.0a2? I won't be applying XHTML compliance changes to 1.0.x branch and hence having it against the other branch will make it easier to apply.
Migrate your MantisBT to the MantisHub Cloud
jrmarino
Posts: 13
Joined: 11 Feb 2007, 19:01

Post by jrmarino »

honestly it would not be "easier" - since my production server is running 1.0.6, it would be "easier" to fix that and deliver the updated files.

I could be persuaded to update the production server to the latest beta if it was rock solid stable. However, I just read a post that a3 is coming out so I would wait until after then anyway.

so I'm kind of stuck -- I don't really want to install a dummy version especially since my dev server (at home under my desk) crapped out with a bad hard drive and I don't want to screw up a productive version either.
Narcissus
Developer
Posts: 338
Joined: 17 Feb 2005, 09:45

Post by Narcissus »

vb: if you don't have the time, I can give it a shot if you like... I've been knocking myself for not having done any work on Mantis for a while now, so something like that could be a good way to get reacquainted with the code.

Just let me know and we can tee everything up.
vboctor
Site Admin
Posts: 1304
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Post by vboctor »

Narcissus, that would be great. Please go for it :)
Migrate your MantisBT to the MantisHub Cloud
Narcissus
Developer
Posts: 338
Joined: 17 Feb 2005, 09:45

Post by Narcissus »

Excellent. jrmarino: I've sent you a PM with my email address so that we can work out the best way to do this.

Thanks.
jrmarino
Posts: 13
Joined: 11 Feb 2007, 19:01

Post by jrmarino »

The nested form problem is a nasty one.

I'm talking about the table of filters, for example, on the view all bugs page.
Here's how it's currently set up (briefly):

Code: Select all

<form>
  <table>
  {many rows}
    <tr>
        <td>search</form>
        <td>test</td>
        <td><form>reset filter</form><form>save filter</form></td>
    </tr>
  </table>
You can't do that.
The first </form> has to be outside the table.

The three options to fix this are:
  1. close the table, then the first form after the SEARCH option. Reset filter and save filter are outside this table, maybe in their own table below it.
  2. Change the code for save/reset filter to not require to be a form -- maybe use url variables instead of post variables. requires code change
  3. piggyback save/reset filter on the same form. There's no problem having 3 submit buttons for one form. requires code change.
This is not "nice" for XHTML, it's broken HTML. You can't have forms out of scope like that.

How would you like this fixed?
jrmarino
Posts: 13
Joined: 11 Feb 2007, 19:01

Post by jrmarino »

We're at a holding point here -- looking for direction.
I would recommend option 3.
Narcissus
Developer
Posts: 338
Joined: 17 Feb 2005, 09:45

Post by Narcissus »

Oops sorry: missed this.

Assuming vb has no preference either way, I would say I prefer option 3 as well.
vboctor
Site Admin
Posts: 1304
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Post by vboctor »

Option 3 while maintaining the same look and feel is fine by me.
Migrate your MantisBT to the MantisHub Cloud
jrmarino
Posts: 13
Joined: 11 Feb 2007, 19:01

Post by jrmarino »

Just an update here -

Option 3 is not going to work. First, there are more than 3 forms involved. There can also be a list of filters and a manage filters form. Secondly, there are at least 3 unique form targets.

One approach would be to use javascript to manipulate the master form values, including changing the form target. It gets a bit messy as the forms may or may not have add the variables defined, and some use variables commonly. In the case of the filter, it's both a dropdown and a hidden value.

For now, I'm going to fall back to trying to change the html elements with an attempt to maintain the current look.
jrmarino
Posts: 13
Joined: 11 Feb 2007, 19:01

Post by jrmarino »

Okay, I have fixed this with the HTML only. Please see here:

http://www.synsport.com/mantis/view_all_bug_page.php

This page validates and as far as I can tell, the filters work normally and *appear* to look as before. I did struggle to make it work in Firefox, Opera, IE 6, and IE 7 equally, but I finally did it.

Also note that the filter table had the colspan set incorrectly on the 5th and 6th row, 5th column. It was spanning 2 instead of the fourth column.


Honestly - it's terrible that the presentation and the code are mixed together like this. Splitting presentation out is what templates are for - this code is quite unnecessarily complicated due to having HTML conditions dispersed everywhere.
Post Reply