struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Benedict <pbened...@apache.org>
Subject Re: [s 1.3.6]: New label tag
Date Tue, 21 Nov 2006 04:58:35 GMT
Martin Cooper wrote:
>
> How about we just stick with 'for'? We have generally tried to use the 
> same
> name for an attribute as for what will be rendered, and there's no 
> reason we
> can't use 'for' (unlike 'id' which we could not use, which is why 
> 'styleId'
> exists).
This is fine by me. Spring Framework now has a tag library that's 
similar to Struts (and generally seems inspired by it), and they also 
have a "label" tag with a matching "for" attribute. So this I will make 
sure exists.

> Well, this seems to introduce a double reference which then leaves 
> potential
> for error / confusion. Don't 'property' and 'for' ultimately reference 
> the
> same thing? Yes, the former references the form bean property and the 
> latter
> the text element (or whatever) id, but really it's the same thing, no?
These two properties are not similar. "for" is for a emitting DOM id, 
while "property" determines which form property Action errors should be 
investigated to trigger the error styles. The two are, unfortunately, 
necessary.... however because I have seen the duplication problem from 
the beginning, my decision was to make the "for" tag attribute optional. 
If no "for" tag attribute is specified, the DOM id emitted in the HTML 
"for" attribute is the name of the property. So you can shorthand it:

<html:label property="firstName" errorStyle="error">First Name</html:label>
<html:text property=firstName" styleId="firstName" />

> Two other observations:
>
> 1) This seems like yet another special case of error handling that we are
> loading on to the tags. How many special cases do we really want in our
> taglibs for rendering error situation? I guess what I'm asking is why 
> should
> a label get special treatment over, say, adding a red asterisk after the
> field, or whatever?
Using CSS 2, you can add body content in a style. So if you want to add 
an asterisk, you just write that rule into your style sheet -- just make 
sure you have a browser which can support it.
>
> 2) We could generalise this whole thing by creating a tag that exists 
> solely
> to provide for style differences in error situations, without tying it to
> something like a label tag. 
True, except I don't want to create a radical new tag library structure 
for Struts 1. I am all for new ideas in Struts 2, but I would like this 
to be considered a "minor" addition. It's much easier adding the label 
tag to complete the library of form components, imo.

So I'd like a buy-in so I can commit the code :-) More suggestions for 
improvements are totally welcomed.

Paul


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


Mime
View raw message