You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by rgm <rg...@rgm.nu> on 2013/09/11 17:59:17 UTC

Proposal: "required" attribute changes (related to WW-4188)

So as not to pollute the JIRAs too much with speculation or suggestions
that haven't been thought out, I'd like to have a discussion about the
"required" attribute here on the list.

I propose that we revert the changes made in WW-3908, namely -- turn
"requiredLabel" back into "required."   Then, to support the html5 required
boolean attribute, change "themes/simple/text.ftl" to check <#if
parameters.required?default(false)> required="required" </#if>.

This is a backwards compatible change (from the themes/simple/text.ftl
perspective).  It is also backwards compatible with templates made before
Struts 2.3.12.

It has a side effect that modern browsers will enforce client-side
validation for text fields like this:
<@s.textfield name="whatever" required=true />

I believe this side effect to be universally beneficial, but I could be
wrong about that.

CONS:

* Some folks have already gone and updated their templates to change
"required" to "requiredLabel."   These folks would have to go back and
revert that, unless logic was put in to see if requiredLabel was one of
"true" "false" or other.  :-/   On the other hand, this frees up the
"requiredLabel" attribute to be a String again, and allow per-field
overriding of the default asterisk (*) character.

* (maybe) Some folks may not want clients to enforce "required" in forms.

PROS:

* html5 required attribute, being specific to the way a tag is rendered,
should be handled in themes where rendering logic exists.

* Avoids "required=false" problem in 2.3.15.1, which confusingly does cause
modern browsers to require a field.   For this reason alone, "required"
should not be a dynamic attribute.

* Backwards compatible with pre-2.3.12 templates.

* (subjective) Tag usage feels more natural -- "required" sounds like a
boolean,  "requiredLabel" sounds like a String.

What do you guys think?

-rgm

RE: Proposal: "required" attribute changes (related to WW-4188)

Posted by Martin Gainty <mg...@hotmail.com>.
MG>radiobuttons are tricky
MG>if any of the radio buttons with type="radio" contain the required attribute 
MG>then all of elements with type="radio" (the radiogroup collection) are considered to be 'required'
MG>http://www.w3.org/TR/html5/forms.html#the-required-attribute
MG>enabling "HTML5 compliance" justifies the effort
MG>+1

 

> From: lukaszlenart@apache.org
> Date: Thu, 12 Sep 2013 11:18:27 +0200
> Subject: Re: Proposal: "required" attribute changes (related to WW-4188)
> To: dev@struts.apache.org
> 
> Duplication or do you want to start that over?
> 
> 2013/9/11 rgm <rg...@rgm.nu>:
> > So as not to pollute the JIRAs too much with speculation or suggestions
> > that haven't been thought out, I'd like to have a discussion about the
> > "required" attribute here on the list.
> >
> > I propose that we revert the changes made in WW-3908, namely -- turn
> > "requiredLabel" back into "required."   Then, to support the html5 required
> > boolean attribute, change "themes/simple/text.ftl" to check <#if
> > parameters.required?default(false)> required="required" </#if>.
> >
> > This is a backwards compatible change (from the themes/simple/text.ftl
> > perspective).  It is also backwards compatible with templates made before
> > Struts 2.3.12.
> >
> > It has a side effect that modern browsers will enforce client-side
> > validation for text fields like this:
> > <@s.textfield name="whatever" required=true />
> >
> > I believe this side effect to be universally beneficial, but I could be
> > wrong about that.
> >
> > CONS:
> >
> > * Some folks have already gone and updated their templates to change
> > "required" to "requiredLabel."   These folks would have to go back and
> > revert that, unless logic was put in to see if requiredLabel was one of
> > "true" "false" or other.  :-/   On the other hand, this frees up the
> > "requiredLabel" attribute to be a String again, and allow per-field
> > overriding of the default asterisk (*) character.
> >
> > * (maybe) Some folks may not want clients to enforce "required" in forms.
> >
> > PROS:
> >
> > * html5 required attribute, being specific to the way a tag is rendered,
> > should be handled in themes where rendering logic exists.
> >
> > * Avoids "required=false" problem in 2.3.15.1, which confusingly does cause
> > modern browsers to require a field.   For this reason alone, "required"
> > should not be a dynamic attribute.
> >
> > * Backwards compatible with pre-2.3.12 templates.
> >
> > * (subjective) Tag usage feels more natural -- "required" sounds like a
> > boolean,  "requiredLabel" sounds like a String.
> >
> > What do you guys think?
> >
> > -rgm
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
> 
 		 	   		  

Re: Proposal: "required" attribute changes (related to WW-4188)

Posted by Lukasz Lenart <lu...@apache.org>.
Duplication or do you want to start that over?

2013/9/11 rgm <rg...@rgm.nu>:
> So as not to pollute the JIRAs too much with speculation or suggestions
> that haven't been thought out, I'd like to have a discussion about the
> "required" attribute here on the list.
>
> I propose that we revert the changes made in WW-3908, namely -- turn
> "requiredLabel" back into "required."   Then, to support the html5 required
> boolean attribute, change "themes/simple/text.ftl" to check <#if
> parameters.required?default(false)> required="required" </#if>.
>
> This is a backwards compatible change (from the themes/simple/text.ftl
> perspective).  It is also backwards compatible with templates made before
> Struts 2.3.12.
>
> It has a side effect that modern browsers will enforce client-side
> validation for text fields like this:
> <@s.textfield name="whatever" required=true />
>
> I believe this side effect to be universally beneficial, but I could be
> wrong about that.
>
> CONS:
>
> * Some folks have already gone and updated their templates to change
> "required" to "requiredLabel."   These folks would have to go back and
> revert that, unless logic was put in to see if requiredLabel was one of
> "true" "false" or other.  :-/   On the other hand, this frees up the
> "requiredLabel" attribute to be a String again, and allow per-field
> overriding of the default asterisk (*) character.
>
> * (maybe) Some folks may not want clients to enforce "required" in forms.
>
> PROS:
>
> * html5 required attribute, being specific to the way a tag is rendered,
> should be handled in themes where rendering logic exists.
>
> * Avoids "required=false" problem in 2.3.15.1, which confusingly does cause
> modern browsers to require a field.   For this reason alone, "required"
> should not be a dynamic attribute.
>
> * Backwards compatible with pre-2.3.12 templates.
>
> * (subjective) Tag usage feels more natural -- "required" sounds like a
> boolean,  "requiredLabel" sounds like a String.
>
> What do you guys think?
>
> -rgm

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org