Forms generate invalid xhtml using the xhtml profile
----------------------------------------------------

                 Key: WW-1888
                 URL: https://issues.apache.org/struts/browse/WW-1888
             Project: Struts 2
          Issue Type: Bug
          Components: Views
    Affects Versions: 2.0.6
            Reporter: Niko Korhonen
            Priority: Minor


Struts 2 forms with the XHTML profile seem to have some XHTML compliancy 
problems.

The <s:submit> tag inside <s:form> produces invalid XHTML. The submit tag 
produces code like this:

<td colspan="2">
  <div align="right"><input type="submit" id="SettingsSubmit_0" 
value="Submit"/></div>
</td>

The problem is that the "align" attribute of the div tag is deprecated since 
HTML 4.01 and is not valid XHTML. This can be fixed by including the align 
attribute to the td tag as such:

<td colspan="2" align="right">

Using validation in forms produces invalid XHTML code. The required attribute 
"type" not specified in the produced script tag:

<script src="/../struts/xhtml/validation.js"></script>

This can be corrected by including the type attribute as such:

<script src="/../struts/xhtml/validation.js" type="text/javascript"></script>

The form tag generates this code:

<form namespace="/pages/webui" id="SettingsSubmit" name="SettingsSubmit" 
onsubmit="return validateForm_SettingsSubmit();" 
action="/../SettingsSubmit.jspa" method="POST">

There are some problems here:

1. There are no "name" attribute in XHTML. This can be fixed by removing it 
completely and only using "id".
2. There is no "namespace" attribute in XHTML. I don't know how this can be 
fixed. I use an edited template that does not produce the "namespace" attribute 
at all.
3. "POST" should be written in lowercase, i.e. "post".

All of these issues can be fixed by editing the XHTML template files. I can 
provide my own modifications if needed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to