Yes, that is part of the modifications I am proprosing.
The way I have set it up to work currently involves the creation of a new
LabelTag that would be used the following way.

<html:label property="firstName" styleClass="normal"
errorStyleClass="error"><bean:message key="firstName"/></html:label>

(if the users extended the LabelTag and set up default values)
public class LabelTag extends the.struts.LabelTag {
    public LabelTag() {
        super();
        super.setStyleClass(Constants.NORMAL);
        super.setErrorStyleClass(Constants.ERROR);
        ...
}

Then it would be dumbed down to: (where input is the extended tag library)
<input:label property="firstName"><bean:message
key="firstName"/></input:label>

I chose to keep presentation out of the bean library for two reasons:
* MessageTag currently does not specify any type of style, and I thought it
would be cleaner to keep it that way.
* By wrapping whatever they want with the new LabelTag, developers are not
locked in to using the MessageTag to get formatted messages.

-Jonathan




-----Original Message-----
From: Jeff Robertson [mailto:[EMAIL PROTECTED]
Sent: Monday, June 09, 2003 8:30 AM
To: 'Struts Developers List'
Subject: RE: Introduction and a proprosal to add new functionality to
Struts: Automatic highlighting of errored form elements


> -----Original Message-----
>
> A quick note, when I wrote 'automatic highlighting of errored form
> elements': it is only automatic if a style has been defined to use.
> Example:
> < html:text property="name" styleClass="valid"
> errorStyleClass="invalid" ...
> where 'valid' is the css style class to use normally and
> 'invalid' would be
> used if there was an error.
> if no errorStyleClass was defined, there would be no highlighting.
>

Do you also have an alternate style for the input's label text?

For instance, a form often looks like this:

<bean:message key="firstName"/> <html:text property="firstName" /><br>
<bean:message key="lastName"/> <html:text property="lastName" /><br>
<bean:message key="address"/> <html:text property="address" /><br>

If the "address" property fails validation, then one would normally expect
that the bean message (which probably just displays the word "Enter you
Address Here" or something) would be highlighted as well.


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




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

Reply via email to