[
https://issues.apache.org/jira/browse/WW-3908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13764339#comment-13764339
]
Roland McIntosh commented on WW-3908:
-------------------------------------
Handling via dynamicAttributes is the wrong way to do it, because the HTML5
"required" attribute is a [boolean
attribute|http://www.whatwg.org/specs/web-apps/current-work/#boolean-attribute]
-- it is only ever supposed to be {{required="required"}} or missing entirely.
The right-hand side (what it's equal to) doesn't matter. And the "text.ftl"
file I was referring to was "simple/text.ftl", which we definitely have. Or
at least css_xhtml/text.ftl.
The problem with having it as a dynamicAttribute is that people can specify
"required=false" on the struts tag. This yields "required="false"" in the
output, which confusingly actually DOES require the field and breaks
expectations.
I believe that changing the themes to add "required='required'" and preserving
the struts tag attribute boolean name of "required" is a better solution. In
some respects this reverts to pre-2.3.12 behavior. Moving discussion to users
list now.
> FreeMarker textfield tag doesn't allow the new HTML5 required attribute
> -----------------------------------------------------------------------
>
> Key: WW-3908
> URL: https://issues.apache.org/jira/browse/WW-3908
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.3.7
> Environment: Windows 7 + JDK1.6.0_27 + The new Struts2 2.3.6 +
> FreeMarker 2.3.19
> Reporter: Loic VSCT
> Assignee: Lukasz Lenart
> Fix For: 2.3.12
>
>
> It is impossible to use the new HTML5 *required* attribute with the
> *textfield* tag currently available in FreeMarker. Other HTML5 attributes
> seem to work as expected.
> => For example, I want to use the new *required* attribute in order to have
> the following very simple HTML code :
> {code:html}
> <input type="text" required="required" id="test-X">
> {code}
> => I have tried to use the following code in a classic FTL file :
> {code:title=test.ftl|borderStyle=solid}
> <@s.textfield required="required" id="test-1"/>
> <@s.textfield required="true" id="test-2"/>
> <@s.textfield required=required id="test-3"/>
> <@s.textfield required=true id="test-4"/>
> {code}
> The HTML result is always :
> {code:html}
> <input type="text" id="test-X">
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira