On 11/18/06, Paul Benedict <[EMAIL PROTECTED]> wrote:

Martin,
> I guess I'm not quite getting how the various attributes would work. It
> seems to me that you really only need 'for'
That currently exists as "forStyleId". My question was is that a good
name? I was trying to make the attribute consistent with the "styleId"
and "errorStyleId" naming convention.


Hmm. Personally, I think 'styleId' is a poor name in the first place, so I'm
not all that enamored of perpetuating it. (It seemed like a decent choice at
the time, but that was many years ago, and if we were to be choosing the
name today, I'd have suggested 'domId' instead. But that's all water under
the bridge. ;)

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).

An aside: How did we end up with the 'errorStyleId' thing? I must have been
asleep when that happened. Why on earth would I want to give an element a
different DOM identifier if there's an error in the field's value? That
would certainly complicate any JavaScript code I have that references that
element. A different style, yes, but a different id?

and why you need a 'property' attribute.
>
To associate the label with a form property: "styleId" and
"errorStyleId" are tied to that property. So this allows not only a text
box to change it's style, but also the label pointing to the text box.


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? Do we
really need both?

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?

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. For example, we could have the tag emit a span
or div that has an association with a property and so can render differently
in normal and error cases. With that, you could simply wrap your label - or
any other field or fragment of HTML, which is really the point - with this
new tag and be done with it.

--
Martin Cooper


Do I make sense? (Dangerous question :-) )

Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to